Skip to content

Commit

Permalink
Merge pull request #504 from Kadu-H/main
Browse files Browse the repository at this point in the history
Fix main window maximizing from splash
  • Loading branch information
zamitto authored May 26, 2024
2 parents c648ce3 + 965046d commit 21305d3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/services/window-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +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 isMainMaximized = false;

private static loadURL(hash = "") {
// HMR for renderer base on electron-vite cli.
Expand Down Expand Up @@ -71,6 +72,10 @@ export class WindowManager {

this.loadSplashURL();
this.splashWindow.removeMenu();
if (this.splashWindow?.isMaximized()) {
this.splashWindow?.unmaximize();
this.isMainMaximized = true;
}
}

public static createMainWindow() {
Expand All @@ -94,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 () => {
Expand Down

0 comments on commit 21305d3

Please sign in to comment.