mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +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:
parent
e5cffbe598
commit
4d72392f1d
1 changed files with 7 additions and 3 deletions
|
@ -20,6 +20,8 @@ export class WindowManager {
|
||||||
public static splashWindow: Electron.BrowserWindow | null = null;
|
public static splashWindow: Electron.BrowserWindow | null = null;
|
||||||
public static isReadyToShowMainWindow = false;
|
public static isReadyToShowMainWindow = false;
|
||||||
|
|
||||||
|
private static isMainMaximize = 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.
|
||||||
// Load the remote URL for development or the local html file for production.
|
// Load the remote URL for development or the local html file for production.
|
||||||
|
@ -71,6 +73,10 @@ export class WindowManager {
|
||||||
|
|
||||||
this.loadSplashURL();
|
this.loadSplashURL();
|
||||||
this.splashWindow.removeMenu();
|
this.splashWindow.removeMenu();
|
||||||
|
if (this.splashWindow?.isMaximized()) {
|
||||||
|
this.splashWindow?.unmaximize();
|
||||||
|
this.isMainMaximize = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static createMainWindow() {
|
public static createMainWindow() {
|
||||||
|
@ -119,9 +125,7 @@ export class WindowManager {
|
||||||
this.isReadyToShowMainWindow = true;
|
this.isReadyToShowMainWindow = true;
|
||||||
this.splashWindow?.close();
|
this.splashWindow?.close();
|
||||||
this.createMainWindow();
|
this.createMainWindow();
|
||||||
if (this.splashWindow?.isMaximized()) {
|
if (this.isMainMaximize) this.mainWindow?.maximize();
|
||||||
this.mainWindow?.maximize();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static redirect(hash: string) {
|
public static redirect(hash: string) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue