From 18812bda1088ee00bc690f3823ac8dae8a50cbca Mon Sep 17 00:00:00 2001 From: webadderall <131426131+webadderall@users.noreply.github.com> Date: Sun, 5 Apr 2026 23:23:16 +1000 Subject: [PATCH] Fix Windows tray restore during recording --- electron/main.ts | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/electron/main.ts b/electron/main.ts index f5f1b89f..8e5ee927 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -160,6 +160,29 @@ function getRecordingTrayIcon() { return recordingTrayIcon; } +function showHudOverlayFromTray() { + const hud = getHudOverlayWindow(); + if (!hud) { + return false; + } + + if (hud.isMinimized()) { + hud.restore(); + } + + if (process.platform === "win32" && isHudOverlayMousePassthroughSupported()) { + hud.showInactive(); + hud.moveTop(); + reassertHudOverlayMouseState(); + return true; + } + + hud.show(); + hud.moveTop(); + hud.focus(); + return true; +} + ipcMain.on("set-has-unsaved-changes", (_event, hasChanges: boolean) => { editorHasUnsavedChanges = hasChanges; }); @@ -214,6 +237,7 @@ function focusOrCreateMainWindow() { !isEditorWindow(mainWindow) && isHudOverlayMousePassthroughSupported() ) { + showHudOverlayFromTray(); return; } @@ -371,6 +395,7 @@ function setupApplicationMenu() { function createTray() { tray = new Tray(getDefaultTrayIcon()); tray.on("click", () => focusOrCreateMainWindow()); + tray.on("double-click", () => focusOrCreateMainWindow()); } function getPublicAssetPath(filename: string) { @@ -582,6 +607,14 @@ function updateTrayMenu(recording: boolean = false) { const trayToolTip = recording ? `Recording: ${selectedSourceName}` : "Recordly"; const menuTemplate = recording ? [ + { + label: "Show Controls", + click: () => { + if (!showHudOverlayFromTray()) { + focusOrCreateMainWindow(); + } + }, + }, { label: "Stop Recording", click: () => { @@ -595,13 +628,8 @@ function updateTrayMenu(recording: boolean = false) { { label: "Open", click: () => { - if (mainWindow && !mainWindow.isDestroyed()) { - if (mainWindow.isMinimized()) mainWindow.restore(); - mainWindow.show(); - mainWindow.focus(); - mainWindow.moveTop(); - } else { - createWindow(); + if (!showHudOverlayFromTray()) { + focusOrCreateMainWindow(); } }, },