From 4655e71ca50015e0d2f37f3d93feadfb172f61b6 Mon Sep 17 00:00:00 2001 From: elevchyt Date: Mon, 16 Mar 2026 19:25:12 +0200 Subject: [PATCH] notification area hud open fix with small window open refactor --- electron/main.ts | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/electron/main.ts b/electron/main.ts index 257e0b2..23bcc49 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -70,6 +70,19 @@ function createWindow() { mainWindow = createHudOverlayWindow(); } +function showMainWindow() { + if (mainWindow && !mainWindow.isDestroyed()) { + if (mainWindow.isMinimized()) { + mainWindow.restore(); + } + mainWindow.show(); + mainWindow.focus(); + return; + } + + createWindow(); +} + function isEditorWindow(window: BrowserWindow) { return window.webContents.getURL().includes("windowType=editor"); } @@ -177,6 +190,12 @@ function setupApplicationMenu() { function createTray() { tray = new Tray(defaultTrayIcon); + tray.on("click", () => { + showMainWindow(); + }); + tray.on("double-click", () => { + showMainWindow(); + }); } function getTrayIcon(filename: string) { @@ -208,11 +227,7 @@ function updateTrayMenu(recording: boolean = false) { { label: "Open", click: () => { - if (mainWindow && !mainWindow.isDestroyed()) { - mainWindow.isMinimized() && mainWindow.restore(); - } else { - createWindow(); - } + showMainWindow(); }, }, { @@ -355,7 +370,7 @@ app.whenReady().then(async () => { if (!tray) createTray(); updateTrayMenu(recording); if (!recording) { - if (mainWindow) mainWindow.restore(); + showMainWindow(); } }, );