diff --git a/main.ts b/main.ts index 25b9fc9a..b4784dd0 100644 --- a/main.ts +++ b/main.ts @@ -17,9 +17,6 @@ import registerIpcMainMessageListeners from './main/registerIpcMainMessageListen import registerProcessListeners from './main/registerProcessListeners'; import { IPC_CHANNELS } from './utils/messages'; -const WIDTH = 1200; -const HEIGHT = 900; - export class Main { title: string = 'Frappe Books'; icon: string; @@ -29,6 +26,9 @@ export class Main { checkedForUpdate = false; mainWindow: BrowserWindow | null = null; + WIDTH = 1200; + HEIGHT = 900; + constructor() { this.icon = this.isDevelopment ? path.resolve('./build/icon.png') @@ -75,8 +75,8 @@ export class Main { vibrancy: 'sidebar', transparent: this.isMac, backgroundColor: '#80FFFFFF', - width: WIDTH, - height: HEIGHT, + width: this.WIDTH, + height: this.HEIGHT, title: this.title, webPreferences: { contextIsolation: false, // TODO: Switch this off diff --git a/main/registerAppLifecycleListeners.ts b/main/registerAppLifecycleListeners.ts index 588532d0..3156d466 100644 --- a/main/registerAppLifecycleListeners.ts +++ b/main/registerAppLifecycleListeners.ts @@ -1,5 +1,4 @@ import { app } from 'electron'; -// @ts-ignore import installExtension, { VUEJS3_DEVTOOLS } from 'electron-devtools-installer'; import { Main } from '../main'; diff --git a/main/registerIpcMainActionListeners.ts b/main/registerIpcMainActionListeners.ts index 0f6a46bc..06606c5c 100644 --- a/main/registerIpcMainActionListeners.ts +++ b/main/registerIpcMainActionListeners.ts @@ -13,13 +13,14 @@ import { IPC_ACTIONS } from '../utils/messages'; export default function registerIpcMainActionListeners(main: Main) { ipcMain.handle(IPC_ACTIONS.TOGGLE_MAXIMIZE_CURRENT_WINDOW, (event) => { - const maximizing = main.mainWindow!.isMaximized(); - if (maximizing) { - main.mainWindow!.maximize(); + const maximized = main.mainWindow!.isFullScreen(); + if (maximized) { + main.mainWindow?.setFullScreen(false); + main.mainWindow?.setSize(main.WIDTH, main.HEIGHT, true); } else { - main.mainWindow!.unmaximize(); + main.mainWindow?.setFullScreen(true); } - return maximizing; + return maximized; }); ipcMain.handle(IPC_ACTIONS.GET_OPEN_FILEPATH, async (event, options) => { diff --git a/src/components/WindowControls.vue b/src/components/WindowControls.vue index 55e4bc8e..1df4a75d 100644 --- a/src/components/WindowControls.vue +++ b/src/components/WindowControls.vue @@ -19,8 +19,7 @@