diff --git a/electron/main.ts b/electron/main.ts index 636c29ff5..cd93c1675 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -154,7 +154,21 @@ function restoreWindowSafely(window: BrowserWindow | null) { return; } - window.restore(); + if (!isEditorWindow(window) && process.platform === "win32") { + showHudOverlayFromTray(); + return; + } + + if (window.isMinimized()) { + window.restore(); + } + + if (!window.isVisible()) { + window.show(); + } + + window.moveTop(); + window.focus(); } // Tray Icons (lazily created after app is ready to avoid accessing Electron APIs too early) diff --git a/electron/windows.ts b/electron/windows.ts index 819c2b5c1..b3afc8056 100644 --- a/electron/windows.ts +++ b/electron/windows.ts @@ -904,7 +904,12 @@ export function createCountdownWindow(): BrowserWindow { win.webContents.on("did-finish-load", () => { if (!win.isDestroyed()) { - win.show(); + if (process.platform === "win32") { + win.showInactive(); + win.moveTop(); + } else { + win.show(); + } } }); diff --git a/src/hooks/useScreenRecorder.ts b/src/hooks/useScreenRecorder.ts index f95c65ad9..daf88c0f5 100644 --- a/src/hooks/useScreenRecorder.ts +++ b/src/hooks/useScreenRecorder.ts @@ -1300,8 +1300,14 @@ export function useScreenRecorder(): UseScreenRecorderReturn { : "Failed to start recording", ); setRecording(false); - cleanupCapturedMedia(); - await stopWebcamRecorder(); + try { + await window.electronAPI?.setRecordingState(false); + } catch (stateError) { + console.warn("Failed to reset main-process recording state:", stateError); + } finally { + cleanupCapturedMedia(); + await stopWebcamRecorder(); + } } finally { startInFlight.current = false; setStarting(false);