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.
This commit is contained in:
Kdu 2024-05-25 19:18:08 -03:00
parent 4d72392f1d
commit 1e84a1558f

View file

@ -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 () => {