From e5cffbe59887e821302e117bf3311de85a1285af Mon Sep 17 00:00:00 2001 From: Kdu Date: Fri, 24 May 2024 12:46:37 -0300 Subject: [PATCH 1/5] Fix main window maximization from splash The code checks whether the initial window is maximized, if so, it leaves the main window also maximized. --- src/main/services/window-manager.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/services/window-manager.ts b/src/main/services/window-manager.ts index e435ddb22..02e0e4444 100644 --- a/src/main/services/window-manager.ts +++ b/src/main/services/window-manager.ts @@ -119,6 +119,9 @@ export class WindowManager { this.isReadyToShowMainWindow = true; this.splashWindow?.close(); this.createMainWindow(); + if (this.splashWindow?.isMaximized()) { + this.mainWindow?.maximize(); + } } public static redirect(hash: string) { From 4d72392f1d76affffbddf7eafc13c220b8b07a0a Mon Sep 17 00:00:00 2001 From: Kdu Date: Fri, 24 May 2024 15:02:45 -0300 Subject: [PATCH 2/5] Fix main window maximizing from splash The code checks whether the initial window starts maximized, if so, prevents the splash from starting maximized and leaves the main window maximized. --- src/main/services/window-manager.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/services/window-manager.ts b/src/main/services/window-manager.ts index 02e0e4444..66d27cae2 100644 --- a/src/main/services/window-manager.ts +++ b/src/main/services/window-manager.ts @@ -20,6 +20,8 @@ export class WindowManager { public static splashWindow: Electron.BrowserWindow | null = null; public static isReadyToShowMainWindow = false; + private static isMainMaximize = false; + private static loadURL(hash = "") { // HMR for renderer base on electron-vite cli. // Load the remote URL for development or the local html file for production. @@ -71,6 +73,10 @@ export class WindowManager { this.loadSplashURL(); this.splashWindow.removeMenu(); + if (this.splashWindow?.isMaximized()) { + this.splashWindow?.unmaximize(); + this.isMainMaximize = true; + } } public static createMainWindow() { @@ -119,9 +125,7 @@ export class WindowManager { this.isReadyToShowMainWindow = true; this.splashWindow?.close(); this.createMainWindow(); - if (this.splashWindow?.isMaximized()) { - this.mainWindow?.maximize(); - } + if (this.isMainMaximize) this.mainWindow?.maximize(); } public static redirect(hash: string) { From 1e84a1558f52cf9ede39c48f6085a690a39f9a94 Mon Sep 17 00:00:00 2001 From: Kdu Date: Sat, 25 May 2024 19:18:08 -0300 Subject: [PATCH 3/5] Update to fix main window maximizing from splash The code checks whether the initial window starts maximized; If so, it prevents the splash from starting maximized and leaves the main window maximized. --- src/main/services/window-manager.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/services/window-manager.ts b/src/main/services/window-manager.ts index 66d27cae2..142ac96f2 100644 --- a/src/main/services/window-manager.ts +++ b/src/main/services/window-manager.ts @@ -19,8 +19,7 @@ export class WindowManager { public static mainWindow: Electron.BrowserWindow | null = null; public static splashWindow: Electron.BrowserWindow | null = null; public static isReadyToShowMainWindow = false; - - private static isMainMaximize = false; + private static isMainMaximized = false; private static loadURL(hash = "") { // HMR for renderer base on electron-vite cli. @@ -100,13 +99,16 @@ export class WindowManager { preload: path.join(__dirname, "../preload/index.mjs"), sandbox: false, }, + show: false, }); this.loadURL(); this.mainWindow.removeMenu(); + if (this.isMainMaximized) this.mainWindow?.maximize(); this.mainWindow.on("ready-to-show", () => { if (!app.isPackaged) WindowManager.mainWindow?.webContents.openDevTools(); + WindowManager.mainWindow?.show(); }); this.mainWindow.on("close", async () => { From 080910405282344f2acb2ad5bb1b1d8679673376 Mon Sep 17 00:00:00 2001 From: Kdu Date: Sat, 25 May 2024 19:23:10 -0300 Subject: [PATCH 4/5] Update to fix main window maximizing from splash The code checks whether the initial window starts maximized; If so, it prevents the splash from starting maximized and leaves the main window maximized. --- src/main/services/window-manager.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/services/window-manager.ts b/src/main/services/window-manager.ts index 142ac96f2..2a14c60a9 100644 --- a/src/main/services/window-manager.ts +++ b/src/main/services/window-manager.ts @@ -74,7 +74,7 @@ export class WindowManager { this.splashWindow.removeMenu(); if (this.splashWindow?.isMaximized()) { this.splashWindow?.unmaximize(); - this.isMainMaximize = true; + this.isMainMaximized = true; } } @@ -127,7 +127,7 @@ export class WindowManager { this.isReadyToShowMainWindow = true; this.splashWindow?.close(); this.createMainWindow(); - if (this.isMainMaximize) this.mainWindow?.maximize(); + if (this.isMainMaximized) this.mainWindow?.maximize(); } public static redirect(hash: string) { From 9aa106a63fee8c6f94aaad902eaa85ed79c1cf62 Mon Sep 17 00:00:00 2001 From: Kdu Date: Sat, 25 May 2024 19:33:38 -0300 Subject: [PATCH 5/5] Update to fix main window maximizing from splash The code checks whether the initial window starts maximized; If so, it prevents the splash from starting maximized and leaves the main window maximized. --- src/main/services/window-manager.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/services/window-manager.ts b/src/main/services/window-manager.ts index 2a14c60a9..7b2c87b78 100644 --- a/src/main/services/window-manager.ts +++ b/src/main/services/window-manager.ts @@ -127,7 +127,6 @@ export class WindowManager { this.isReadyToShowMainWindow = true; this.splashWindow?.close(); this.createMainWindow(); - if (this.isMainMaximized) this.mainWindow?.maximize(); } public static redirect(hash: string) {