|
|
@ -2,7 +2,6 @@ |
|
|
|
|
|
|
|
|
|
|
|
const {app, BrowserWindow, ipcMain, globalShortcut} = require("electron"); |
|
|
|
const {app, BrowserWindow, ipcMain, globalShortcut} = require("electron"); |
|
|
|
const path = require("path"); |
|
|
|
const path = require("path"); |
|
|
|
const util = require("util"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const {isDevelopment} = require("./Util"); |
|
|
|
const {isDevelopment} = require("./Util"); |
|
|
|
|
|
|
|
|
|
|
@ -20,6 +19,7 @@ class WindowManager { |
|
|
|
ipcMain.on("WindowManager::openFileDialog", () => this.app.openFile()); |
|
|
|
ipcMain.on("WindowManager::openFileDialog", () => this.app.openFile()); |
|
|
|
ipcMain.on("WindowManager::openFile", (_, path) => this.app.openFile(path)); |
|
|
|
ipcMain.on("WindowManager::openFile", (_, path) => this.app.openFile(path)); |
|
|
|
ipcMain.handle("WindowManager::resize", (_, height) => this.windows.settings.setSize(800, height + (process.platform === "win32" ? 50 : 0), true)); |
|
|
|
ipcMain.handle("WindowManager::resize", (_, height) => this.windows.settings.setSize(800, height + (process.platform === "win32" ? 50 : 0), true)); |
|
|
|
|
|
|
|
ipcMain.handle("WindowManager::presentFullscreen", (_, fullscreen) => this.windows.main.setFullScreen(fullscreen)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
init() { |
|
|
|
init() { |
|
|
@ -40,13 +40,6 @@ class WindowManager { |
|
|
|
if (["win32", "linux"].includes(process.platform)) { |
|
|
|
if (["win32", "linux"].includes(process.platform)) { |
|
|
|
this.windows.settings.removeMenu(); |
|
|
|
this.windows.settings.removeMenu(); |
|
|
|
|
|
|
|
|
|
|
|
// we also need to hide the application menu
|
|
|
|
|
|
|
|
this.mainWindow.on("enter-full-screen", () => { |
|
|
|
|
|
|
|
this.mainWindow.setAutoHideMenuBar(true); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.mainWindow.on("leave-full-screen", () => { |
|
|
|
|
|
|
|
this.mainWindow.setAutoHideMenuBar(false); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.windows.settings.on("close", event => { |
|
|
|
this.windows.settings.on("close", event => { |
|
|
@ -81,6 +74,7 @@ class WindowManager { |
|
|
|
show : false, |
|
|
|
show : false, |
|
|
|
devTools : isDevelopment(), |
|
|
|
devTools : isDevelopment(), |
|
|
|
titleBarStyle : "hiddenInset", |
|
|
|
titleBarStyle : "hiddenInset", |
|
|
|
|
|
|
|
autoHideMenuBar : process.platform === "win32", |
|
|
|
webPreferences : { |
|
|
|
webPreferences : { |
|
|
|
contextIsolation : true, |
|
|
|
contextIsolation : true, |
|
|
|
preload : path.join(__dirname, "..", "contextAPI.js") |
|
|
|
preload : path.join(__dirname, "..", "contextAPI.js") |
|
|
|