From 4d8803e7068a5db7dcef24323549da2a5a04fb24 Mon Sep 17 00:00:00 2001 From: marwan-softdev Date: Fri, 4 Sep 2026 09:02:27 +0800 Subject: [PATCH] fix(linux): enable cursor overlay by default on Linux resolveBrowserCaptureCursorPolicy force-disabled the editor cursor overlay for every browser-capture recording (hideEditorOverlayCursorByDefault: true), and the Linux browser path always uses browser capture, so the animated cursor overlay never appeared for Linux users. Make the policy platform-aware: on Linux keep the overlay enabled by default and skip the Windows-only OS-cursor hiding call. Windows and macOS behavior is unchanged. Users can still turn the overlay off with the editor's Show cursor toggle. --- src/hooks/useScreenRecorder.test.ts | 21 +++++++++++++++++++++ src/hooks/useScreenRecorder.ts | 17 +++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/hooks/useScreenRecorder.test.ts b/src/hooks/useScreenRecorder.test.ts index 1ddceb4e1..e8533e9fd 100644 --- a/src/hooks/useScreenRecorder.test.ts +++ b/src/hooks/useScreenRecorder.test.ts @@ -158,6 +158,27 @@ describe("resolveBrowserCaptureCursorPolicy", () => { hideEditorOverlayCursorByDefault: true, }); }); + + it("enables the editor overlay by default on Linux, where the OS cursor cannot be hidden", () => { + expect(resolveBrowserCaptureCursorPolicy({ platform: "linux" })).toEqual({ + streamCursor: "never", + hideOsCursorBeforeRecording: false, + hideEditorOverlayCursorByDefault: false, + }); + }); + + it("still enables the editor overlay on Linux when native Windows capture failed", () => { + expect( + resolveBrowserCaptureCursorPolicy({ + nativeWindowsCaptureStartFailed: true, + platform: "linux", + }), + ).toEqual({ + streamCursor: "never", + hideOsCursorBeforeRecording: false, + hideEditorOverlayCursorByDefault: false, + }); + }); }); describe("shouldUseNativeWindowsCaptureForSource", () => { diff --git a/src/hooks/useScreenRecorder.ts b/src/hooks/useScreenRecorder.ts index 459652415..8e9606b87 100644 --- a/src/hooks/useScreenRecorder.ts +++ b/src/hooks/useScreenRecorder.ts @@ -190,9 +190,24 @@ export function normalizeBrowserMicrophoneProfile(value?: string | null): Browse export function resolveBrowserCaptureCursorPolicy({ nativeWindowsCaptureStartFailed = false, + platform = "", }: { nativeWindowsCaptureStartFailed?: boolean; + platform?: string; } = {}): BrowserCaptureCursorPolicy { + if (platform === "linux") { + // Linux browser capture runs through xdg-desktop-portal/PipeWire, which + // offers no way to hide the OS cursor globally and typically embeds it + // in the stream even when "never" is requested. Keep the telemetry + // overlay enabled by default and let the editor's "Show cursor" toggle + // turn it off for users who dislike the double cursor. + return { + streamCursor: "never", + hideOsCursorBeforeRecording: false, + hideEditorOverlayCursorByDefault: false, + }; + } + if (nativeWindowsCaptureStartFailed) { // If WGC already failed, avoid the telemetry overlay path that can lag on // constrained Windows systems; keep the browser-captured cursor instead. @@ -1921,8 +1936,10 @@ export function useScreenRecorder(): UseScreenRecorderReturn { resetRecordingClock(recordingSessionTimestamp.current); } + const platform = (await window.electronAPI?.getPlatform?.()) ?? ""; const browserCursorPolicy = resolveBrowserCaptureCursorPolicy({ nativeWindowsCaptureStartFailed, + platform, }); hideEditorOverlayCursorByDefault.current = browserCursorPolicy.hideEditorOverlayCursorByDefault;