mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-19 01:03:57 +00:00
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.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user