Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix:hide handler actually hides window instead of just clearing value
Galactic997e02856836ed
diff --git a/electron/ipc/handlers.ts b/electron/ipc/handlers.tsindex 729408f1e..261d93fc7 100644--- a/electron/ipc/handlers.ts+++ b/electron/ipc/handlers.ts@@ -359,10 +359,37 @@ export function registerIpcHandlers(onRecordingStateChange?: (recording: boolean, sourceName: string) => void,switchToHud?: () => void,) {+ const supportsWindowOpacity = process.platform !== "linux";const countdownOverlayState = {visible: false,value: null as number | null,activeRunId: null as number | null,+ hideCommitId: 0,+ hideCommitTimer: null as ReturnType<typeof setTimeout> | null,+ };+ const COUNTDOWN_OVERLAY_HIDE_DEBOUNCE_MS = 1200;++ const clearCountdownOverlayHideCommit = () => {+ if (countdownOverlayState.hideCommitTimer) {+ clearTimeout(countdownOverlayState.hideCommitTimer);+ countdownOverlayState.hideCommitTimer = null;+ }+ };++ const commitCountdownOverlayHide = (win: BrowserWindow, hideCommitId: number) => {+ if (win.isDestroyed()) {+ return;+ }++ if (countdownOverlayState.visible || countdownOverlayState.hideCommitId !== hideCommitId) {+ return;+ }++ win.hide();+ if (supportsWindowOpacity) {+ // Reset baseline opacity for the next show cycle.+ win.setOpacity(1);+ }};const flushCountdownOverlayState = (win: BrowserWindow) => {@@ -370,14 +397,35 @@ export function registerIpcHandlers(return;}+ clearCountdownOverlayHideCommit();win.webContents.send("countdown-overlay-value", countdownOverlayState.value);- if (countdownOverlayState.visible && !win.isVisible()) {- setTimeout(() => {- if (!win.isDestroyed() && countdownOverlayState.visible && !win.isVisible()) {- win.showInactive();- }- }, 16);+ if (!countdownOverlayState.visible) {+ return;}++ if (win.isVisible()) {+ if (supportsWindowOpacity) {+ win.setOpacity(1);+ }+ return;+ }++ setTimeout(() => {+ if (!win.isDestroyed() && countdownOverlayState.visible && !win.isVisible()) {+ if (supportsWindowOpacity) {+ win.setOpacity(0);+ }+ win.showInactive();++ if (supportsWindowOpacity) {+ setTimeout(() => {+ if (!win.isDestroyed() && countdownOverlayState.visible && win.isVisible()) {+ win.setOpacity(1);+ }+ }, 0);+ }+ }+ }, 16);};ipcMain.handle("countdown-overlay-show", (_, value: number, runId: number) => {@@ -426,16 +474,35 @@ export function registerIpcHandlers(}countdownOverlayState.visible = false;- countdownOverlayState.value = null;+ countdownOverlayState.hideCommitId += 1;+ const hideCommitId = countdownOverlayState.hideCommitId;+ clearCountdownOverlayHideCommit();const win = getCountdownOverlayWindow();if (!win || win.isDestroyed()) {+ countdownOverlayState.value = null;return;}+ if (supportsWindowOpacity) {+ // Hide visually immediately to avoid hide/show compositor flashes on rapid restart.+ win.setOpacity(0);+ }++ countdownOverlayState.value = null;if (!win.webContents.isLoading()) {win.webContents.send("countdown-overlay-value", countdownOverlayState.value);}++ if (!supportsWindowOpacity) {+ win.hide();+ return;+ }++ countdownOverlayState.hideCommitTimer = setTimeout(() => {+ countdownOverlayState.hideCommitTimer = null;+ commitCountdownOverlayHide(win, hideCommitId);+ }, COUNTDOWN_OVERLAY_HIDE_DEBOUNCE_MS);});ipcMain.handle("switch-to-hud", () => {diff --git a/src/components/launch/CountdownOverlay.tsx b/src/components/launch/CountdownOverlay.tsxindex 54ec8e859..71d12c50a 100644--- a/src/components/launch/CountdownOverlay.tsx+++ b/src/components/launch/CountdownOverlay.tsx@@ -11,18 +11,20 @@ export function CountdownOverlay() {return () => unsubscribe();}, []);+ if (value === null) {+ return null;+ }+return (<div className="w-screen h-screen bg-transparent flex items-center justify-center pointer-events-none select-none">- {value === null ? null : (- <div className="flex items-center justify-center w-40 h-40 rounded-full bg-black/50">- <div- className="text-white/90 text-[80px] font-bold leading-none tabular-nums"- style={{ textShadow: "0 4px 24px rgba(0, 0, 0, 0.65)" }}- >- {value}- </div>+ <div className="flex items-center justify-center w-40 h-40 rounded-full bg-black/50">+ <div+ className="text-white/90 text-[80px] font-bold leading-none tabular-nums"+ style={{ textShadow: "0 4px 24px rgba(0, 0, 0, 0.65)" }}+ >+ {value}</div>- )}+ </div></div>);}diff --git a/src/hooks/useScreenRecorder.ts b/src/hooks/useScreenRecorder.tsindex 7c9112da1..6644f42fd 100644--- a/src/hooks/useScreenRecorder.ts+++ b/src/hooks/useScreenRecorder.ts@@ -339,9 +339,7 @@ export function useScreenRecorder(): UseScreenRecorderReturn {const activeRunId = countdownRunId.current;if (cleanup) cleanup();countdownRunId.current += 1;- void window.electronAPI.hideCountdownOverlay(activeRunId).catch((error) => {- console.warn("Failed to hide countdown overlay during cleanup:", error);- });+ void safeHideCountdownOverlay(activeRunId);allowAutoFinalize.current = false;restarting.current = false;discardRecordingId.current = null;@@ -635,6 +633,11 @@ export function useScreenRecorder(): UseScreenRecorderReturn {);}+ if (!isCountdownRunActive(countdownRunToken)) {+ teardownMedia();+ return;+ }+let {width = DEFAULT_WIDTH,height = DEFAULT_HEIGHT,