mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-09 03:37:45 +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", () => {
|
this.mainWindow.on("ready-to-show", () => {
|
||||||
if (!app.isPackaged) WindowManager.mainWindow?.webContents.openDevTools();
|
if (!app.isPackaged) WindowManager.mainWindow?.webContents.openDevTools();
|
||||||
WindowManager.mainWindow?.show();
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
process.argv.includes("--hide") ||
|
process.argv.includes("--hide") ||
|
||||||
process.argv.includes("--hidden")
|
process.argv.includes("--hidden")
|
||||||
) {
|
) {
|
||||||
WindowManager.mainWindow?.hide();
|
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") {
|
if (process.platform !== "darwin") {
|
||||||
tray.addListener("click", () => {
|
tray.addListener("click", () => {
|
||||||
if (this.mainWindow) {
|
if (this.mainWindow) {
|
||||||
if (WindowManager.mainWindow?.isMinimized())
|
if (
|
||||||
WindowManager.mainWindow.restore();
|
WindowManager.mainWindow?.isMinimized() ||
|
||||||
|
!WindowManager.mainWindow?.isVisible()
|
||||||
WindowManager.mainWindow?.focus();
|
) {
|
||||||
return;
|
WindowManager.mainWindow?.show();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
this.createMainWindow();
|
this.createMainWindow();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
tray.addListener("right-click", showContextMenu);
|
tray.addListener("right-click", showContextMenu);
|
||||||
|
Loading…
Reference in New Issue
Block a user