mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-15 04:32:13 +00:00
Merge pull request #504 from Kadu-H/main
Fix main window maximizing from splash
This commit is contained in:
commit
21305d3e39
1 changed files with 8 additions and 0 deletions
|
@ -19,6 +19,7 @@ export class WindowManager {
|
||||||
public static mainWindow: Electron.BrowserWindow | null = null;
|
public static mainWindow: Electron.BrowserWindow | null = null;
|
||||||
public static splashWindow: Electron.BrowserWindow | null = null;
|
public static splashWindow: Electron.BrowserWindow | null = null;
|
||||||
public static isReadyToShowMainWindow = false;
|
public static isReadyToShowMainWindow = false;
|
||||||
|
private static isMainMaximized = false;
|
||||||
|
|
||||||
private static loadURL(hash = "") {
|
private static loadURL(hash = "") {
|
||||||
// HMR for renderer base on electron-vite cli.
|
// HMR for renderer base on electron-vite cli.
|
||||||
|
@ -71,6 +72,10 @@ export class WindowManager {
|
||||||
|
|
||||||
this.loadSplashURL();
|
this.loadSplashURL();
|
||||||
this.splashWindow.removeMenu();
|
this.splashWindow.removeMenu();
|
||||||
|
if (this.splashWindow?.isMaximized()) {
|
||||||
|
this.splashWindow?.unmaximize();
|
||||||
|
this.isMainMaximized = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static createMainWindow() {
|
public static createMainWindow() {
|
||||||
|
@ -94,13 +99,16 @@ export class WindowManager {
|
||||||
preload: path.join(__dirname, "../preload/index.mjs"),
|
preload: path.join(__dirname, "../preload/index.mjs"),
|
||||||
sandbox: false,
|
sandbox: false,
|
||||||
},
|
},
|
||||||
|
show: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.loadURL();
|
this.loadURL();
|
||||||
this.mainWindow.removeMenu();
|
this.mainWindow.removeMenu();
|
||||||
|
if (this.isMainMaximized) this.mainWindow?.maximize();
|
||||||
|
|
||||||
this.mainWindow.on("ready-to-show", () => {
|
this.mainWindow.on("ready-to-show", () => {
|
||||||
if (!app.isPackaged) WindowManager.mainWindow?.webContents.openDevTools();
|
if (!app.isPackaged) WindowManager.mainWindow?.webContents.openDevTools();
|
||||||
|
WindowManager.mainWindow?.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.mainWindow.on("close", async () => {
|
this.mainWindow.on("close", async () => {
|
||||||
|
|
Loading…
Reference in a new issue