From 1f04674aec4dbb468bfbe0b49dc6d707a8828c59 Mon Sep 17 00:00:00 2001 From: webadderall <131426131+webadderall@users.noreply.github.com> Date: Sun, 17 May 2026 19:25:01 +1000 Subject: [PATCH] fix(windows): address PR 517 review feedback --- electron/ipc/monitorResolver.ts | 1 + electron/ipc/register/recording.ts | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/electron/ipc/monitorResolver.ts b/electron/ipc/monitorResolver.ts index daaf576e..e71f36c1 100644 --- a/electron/ipc/monitorResolver.ts +++ b/electron/ipc/monitorResolver.ts @@ -55,6 +55,7 @@ public class MonitorHelper { const result = spawnSync("powershell.exe", ["-NoProfile", "-NonInteractive", "-Command", psScript], { encoding: "utf-8", + timeout: 5000, }); if (result.error || result.status !== 0) { diff --git a/electron/ipc/register/recording.ts b/electron/ipc/register/recording.ts index bd8c8927..699779d3 100644 --- a/electron/ipc/register/recording.ts +++ b/electron/ipc/register/recording.ts @@ -75,7 +75,6 @@ import { waitForWindowsCaptureStart, waitForWindowsCaptureStop, } from "../recording/windows"; -import { getMonitorHandles } from "../monitorResolver"; import { shouldStartWindowsBrowserMicrophoneFallback, shouldUseWindowsBrowserMicrophoneFallback, @@ -439,10 +438,11 @@ export function registerRecordingHandlers( // Windows Graphics Capture (WGC) requires a raw HMONITOR handle. // We attempt to resolve the handle by matching the physical coordinates of the target display. const monitors = getMonitorHandles(); - const matchedMonitor = monitors.find(m => - m.x === Math.round(displayBounds.x) && - m.y === Math.round(displayBounds.y) - ) || monitors[0]; + const matchedMonitor = monitors.find( + (monitor) => + monitor.x === Math.round(displayBounds.x) && + monitor.y === Math.round(displayBounds.y), + ); if (matchedMonitor) { config.displayId = matchedMonitor.handle; @@ -466,6 +466,8 @@ export function registerRecordingHandlers( config.captureSystemAudio = true; config.audioOutputPath = tempAudioPath; setWindowsSystemAudioPath(systemAudioPath); + } else { + setWindowsSystemAudioPath(null); } if (options?.capturesMicrophone && !browserMicFallbackRequested) { @@ -480,6 +482,8 @@ export function registerRecordingHandlers( } else if (browserMicFallbackRequested) { config.captureMic = false; setWindowsMicAudioPath(null); + } else { + setWindowsMicAudioPath(null); } recordNativeCaptureDiagnostics({ @@ -574,6 +578,9 @@ export function registerRecordingHandlers( setNativeScreenRecordingActive(false); setWindowsCaptureProcess(null); setWindowsCaptureTargetPath(null); + setWindowsSystemAudioPath(null); + setWindowsMicAudioPath(null); + setWindowsOrphanedMicAudioPath(null); setWindowsCaptureStopRequested(false); setWindowsCapturePaused(false); return {