mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 00:33:49 +03:00
chore: refactor hidden startup logic and tray click event
This commit is contained in:
parent
0ecd27d4d5
commit
619090961b
@ -135,13 +135,17 @@ export class WindowManager {
|
||||
|
||||
this.mainWindow.on("ready-to-show", () => {
|
||||
if (!app.isPackaged) WindowManager.mainWindow?.webContents.openDevTools();
|
||||
WindowManager.mainWindow?.show();
|
||||
|
||||
if (
|
||||
process.argv.includes("--hide") ||
|
||||
process.argv.includes("--hidden")
|
||||
) {
|
||||
WindowManager.mainWindow?.hide();
|
||||
process.argv = process.argv.filter(
|
||||
(arg) => arg !== "--hide" && arg !== "--hidden"
|
||||
);
|
||||
} else {
|
||||
WindowManager.mainWindow?.show();
|
||||
}
|
||||
});
|
||||
|
||||
@ -317,14 +321,15 @@ export class WindowManager {
|
||||
if (process.platform !== "darwin") {
|
||||
tray.addListener("click", () => {
|
||||
if (this.mainWindow) {
|
||||
if (WindowManager.mainWindow?.isMinimized())
|
||||
WindowManager.mainWindow.restore();
|
||||
|
||||
WindowManager.mainWindow?.focus();
|
||||
return;
|
||||
if (
|
||||
WindowManager.mainWindow?.isMinimized() ||
|
||||
!WindowManager.mainWindow?.isVisible()
|
||||
) {
|
||||
WindowManager.mainWindow?.show();
|
||||
}
|
||||
} else {
|
||||
this.createMainWindow();
|
||||
}
|
||||
|
||||
this.createMainWindow();
|
||||
});
|
||||
|
||||
tray.addListener("right-click", showContextMenu);
|
||||
|
Loading…
Reference in New Issue
Block a user