Skip to content

Revert HUD passthrough and Linux fallback changes#656

Open
webadderall wants to merge 5 commits into
mainfrom
revert/hud-linux-fallback-fixes
Open

Revert HUD passthrough and Linux fallback changes#656
webadderall wants to merge 5 commits into
mainfrom
revert/hud-linux-fallback-fixes

Conversation

@webadderall
Copy link
Copy Markdown
Collaborator

@webadderall webadderall commented Jun 5, 2026

Summary

  • revert the Windows HUD passthrough regressions introduced after v1.3.1
  • revert the Linux HUD/capture fallback changes that destabilized the older behavior
  • keep the branch focused on the existing revert commits already on top of main

Validation

  • npm exec -- vitest run electron/hudOverlayBounds.test.ts src/hooks/useScreenRecorder.test.ts
  • npm exec -- vitest run src/components/video-editor/videoPlayback/zoomAnimation.test.ts

Summary by CodeRabbit

  • Improvements

    • Always-available cursor controls and simplified cursor behavior
    • More responsive HUD mouse interactions using hover-driven handling
    • Simplified OS-cursor hide response (consistent success result)
  • Removed

    • Removed HUD webcam-preview visibility control exposed to the renderer
  • Tests

    • Some internal tests related to source mapping and HUD fallbacks were removed

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 5, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 602dd7ee-d783-43dd-97ab-0c41e2c8133b

📥 Commits

Reviewing files that changed from the base of the PR and between 1804191 and 489e3ca.

📒 Files selected for processing (1)
  • src/components/launch/hooks/useLaunchHudInteractionState.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/launch/hooks/useLaunchHudInteractionState.ts

📝 Walkthrough

Walkthrough

Removes nativeCaptureUnavailable session metadata and HUD webcam-preview sync, deletes source-mapping helpers, inlines Linux-portal sentinel logic, simplifies HUD mouse passthrough APIs, and updates recorder/editor flows and tests to match the reduced session/API shapes.

Changes

Feature removal: nativeCaptureUnavailable, webcam HUD sync, and source mapping simplification

Layer / File(s) Summary
Type contract cleanup
electron/electron-env.d.ts, electron/ipc/types.ts, electron/preload.ts
Removes nativeCaptureUnavailable?: boolean from renderer API and IPC types; simplifies hideOsCursor() return to { success: boolean }; removes hudOverlaySetWebcamPreviewVisible from preload electronAPI bridge.
IPC handler and session contract updates
electron/ipc/register/project.ts, electron/ipc/register/settings.ts
set-current-video-path and set-current-recording-session handlers stop accepting/propagating nativeCaptureUnavailable; hide-cursor handler returns { success: true } on non-Windows platforms.
Linux portal source mapping removal
electron/ipc/register/sourceMapping.ts (deleted), electron/ipc/register/sources.ts, electron/main.ts
Deletes source-mapping helpers and LINUX_PORTAL_SCREEN_SOURCE_ID; sources.ts and main.ts now use literal/inline checks (matchedSource?.id / "screen:linux-portal") for portal routing and sentinel detection.
HUD bounds and webcam preview removal
electron/hudOverlayBounds.ts, electron/hudOverlayBounds.test.ts, electron/windows.ts, src/components/launch/LaunchWindow.tsx
Removes fallback resize/expand predicate helpers and their tests; drops hudOverlayWebcamPreviewVisible state and IPC listener; getHudOverlayBounds() uses fallback-expanded state directly; LaunchWindow stops syncing webcam preview to HUD.
Mouse passthrough and HUD interaction refactoring
electron/windows.ts, src/components/launch/hooks/useLaunchHudInteractionState.ts
Refactors non-passthrough-supported flow, changes reassertHudOverlayMousePassthrough() to a zero-arg function with fixed 50ms delay, and replaces throttled reassert with hover-driven mouseover handling in the HUD interaction hook.
Recording session finalization and browser capture simplification
src/hooks/useScreenRecorder.ts, src/hooks/useScreenRecorder.test.ts, src/components/video-editor/*
Removes nativeCaptureUnavailable from BrowserCaptureCursorPolicy and from all session/video persistence calls; deletes Linux-portal helper exports and simplifies portal routing to id checks; updates tests and UI (SettingsPanel/VideoEditor) to remove cursor-unavailable gating and modal paths.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

Checked

"I hopped through code with tiny paws,
Trimmed old flags and cleaned the laws,
Portal checks inlined, webcam links undone,
HUD now listens when the mouse has fun,
A rabbit's nibble made the paths more run." 🐰✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description lacks required template sections. It is missing Type of Change, Related Issue(s), Screenshots/Video, Testing Guide, and Checklist sections specified in the repository template. Provide complete pull request description following the repository template: add Type of Change selection, link Related Issue(s), include Screenshots/Video if applicable, expand Testing Guide with detailed steps, and complete the Checklist.
Docstring Coverage ⚠️ Warning Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main purpose: reverting HUD passthrough and Linux fallback changes, which aligns with the substantial changes across multiple files related to HUD mouse handling and Linux portal source mapping.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch revert/hud-linux-fallback-fixes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/launch/hooks/useLaunchHudInteractionState.ts (1)

42-55: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Keep the HUD interactive while a popover is open.

On Line 45 and Line 84, the ignore-mouse timers still arm even when openId is non-null. That lets an already-open HUD menu/popover flip the overlay back to click-through mid-interaction.

Suggested fix
 		if (isInteractive) {
 			isMouseOverHudRef.current = true;
 			if (timeoutRef.current) clearTimeout(timeoutRef.current);
 			window.electronAPI?.hudOverlaySetIgnoreMouse?.(false);
-		} else {
+		} else if (openId === null) {
 			isMouseOverHudRef.current = false;
 			if (timeoutRef.current) clearTimeout(timeoutRef.current);
 			timeoutRef.current = setTimeout(() => {
 				if (
+					openId === null &&
 					!isHudDraggingRef.current &&
 					!isWebcamPreviewDraggingRef.current &&
 					!webcamPreviewDragStartRef.current &&
 					!isMouseOverHudRef.current
 				) {
 					window.electronAPI?.hudOverlaySetIgnoreMouse?.(true);
 				}
 			}, 300);
 		}
 	};

 	window.addEventListener("mouseover", handleMouseOver);
 	return () => window.removeEventListener("mouseover", handleMouseOver);
-	}, [isHudDraggingRef, isWebcamPreviewDraggingRef, webcamPreviewDragStartRef]);
+	}, [openId, isHudDraggingRef, isWebcamPreviewDraggingRef, webcamPreviewDragStartRef]);
...
 			timeoutRef.current = setTimeout(() => {
 				if (
+					openId === null &&
 					!isHudDraggingRef.current &&
 					!isWebcamPreviewDraggingRef.current &&
 					!webcamPreviewDragStartRef.current &&
 					!isMouseOverHudRef.current
 				) {
 					window.electronAPI?.hudOverlaySetIgnoreMouse?.(true);
 				}
 			}, 300);
 		},
-		[isHudDraggingRef, isWebcamPreviewDraggingRef, webcamPreviewDragStartRef],
+		[openId, isHudDraggingRef, isWebcamPreviewDraggingRef, webcamPreviewDragStartRef],
 	);

Also applies to: 84-93

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/launch/hooks/useLaunchHudInteractionState.ts` around lines 42
- 55, The timer callback that sets window.electronAPI.hudOverlaySetIgnoreMouse
is firing even when a HUD popover/menu is open; update the logic in the hook
(the blocks using isMouseOverHudRef, timeoutRef and setTimeout) to first check
that openId is null/undefined before arming or executing the timeout callback —
i.e., include a guard referencing openId (from the hook state/params) both
before scheduling timeoutRef.current = setTimeout(...) and inside the timeout
callback so that when openId is non-null the overlay is not switched to
ignore-mouse; apply the same change to the second occurrence that uses
isHudDraggingRef, isWebcamPreviewDraggingRef and webcamPreviewDragStartRef so
popovers remain interactive.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@electron/ipc/register/sources.ts`:
- Around line 127-129: Restore the Linux portal sentinel mapping when returning
screen rows from register/sources.ts: instead of emitting matchedSource?.id or
`screen:fallback:${displayId}` directly, map portal-like identifiers back to the
sentinel "screen:linux-portal" (or call the previous helper such as
normalizeScreenId or mapSourceToSentinel) so that after explicit selection
useScreenRecorder.ts still sees the portal-safe id; ensure both the
matchedSource present branch and the fallback branch normalize to the sentinel
when appropriate and keep the displayName unchanged.

---

Outside diff comments:
In `@src/components/launch/hooks/useLaunchHudInteractionState.ts`:
- Around line 42-55: The timer callback that sets
window.electronAPI.hudOverlaySetIgnoreMouse is firing even when a HUD
popover/menu is open; update the logic in the hook (the blocks using
isMouseOverHudRef, timeoutRef and setTimeout) to first check that openId is
null/undefined before arming or executing the timeout callback — i.e., include a
guard referencing openId (from the hook state/params) both before scheduling
timeoutRef.current = setTimeout(...) and inside the timeout callback so that
when openId is non-null the overlay is not switched to ignore-mouse; apply the
same change to the second occurrence that uses isHudDraggingRef,
isWebcamPreviewDraggingRef and webcamPreviewDragStartRef so popovers remain
interactive.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: bddacc97-8290-4cb9-b3b1-d3556cbaedc5

📥 Commits

Reviewing files that changed from the base of the PR and between 375620b and 1804191.

📒 Files selected for processing (18)
  • electron/electron-env.d.ts
  • electron/hudOverlayBounds.test.ts
  • electron/hudOverlayBounds.ts
  • electron/ipc/register/project.ts
  • electron/ipc/register/settings.ts
  • electron/ipc/register/sourceMapping.test.ts
  • electron/ipc/register/sourceMapping.ts
  • electron/ipc/register/sources.ts
  • electron/ipc/types.ts
  • electron/main.ts
  • electron/preload.ts
  • electron/windows.ts
  • src/components/launch/LaunchWindow.tsx
  • src/components/launch/hooks/useLaunchHudInteractionState.ts
  • src/components/video-editor/SettingsPanel.tsx
  • src/components/video-editor/VideoEditor.tsx
  • src/hooks/useScreenRecorder.test.ts
  • src/hooks/useScreenRecorder.ts
💤 Files with no reviewable changes (9)
  • electron/ipc/register/sourceMapping.ts
  • electron/ipc/register/sourceMapping.test.ts
  • electron/ipc/types.ts
  • src/components/launch/LaunchWindow.tsx
  • electron/hudOverlayBounds.ts
  • electron/hudOverlayBounds.test.ts
  • src/components/video-editor/SettingsPanel.tsx
  • electron/preload.ts
  • src/hooks/useScreenRecorder.test.ts

Comment on lines 127 to 129
return {
id: getScreenSourceIdForDisplay({
displayId,
env: process.env,
matchedSourceId: matchedSource?.id,
platform: process.platform,
}),
id: matchedSource?.id ?? `screen:fallback:${displayId}`,
name: displayName,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Preserve the Linux portal sentinel for screen entries.

Line 128 now emits raw matchedSource.id / screen:fallback:*, but the rest of this revert still only treats "screen:linux-portal" as the Linux portal-safe screen id. After an explicit screen selection, src/hooks/useScreenRecorder.ts stops taking the portal branch, and fallback ids are then rejected at Lines 1590-1596 while raw ids reintroduce the extra/stale portal path electron/main.ts is trying to avoid. Please restore the previous helper-style mapping here, or normalize Linux screen rows back to the sentinel before they leave this handler.

Suggested direction
-				id: matchedSource?.id ?? `screen:fallback:${displayId}`,
+				id: getScreenSourceIdForDisplay({
+					platform: process.platform,
+					displayId,
+					matchedSource,
+				}),
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@electron/ipc/register/sources.ts` around lines 127 - 129, Restore the Linux
portal sentinel mapping when returning screen rows from register/sources.ts:
instead of emitting matchedSource?.id or `screen:fallback:${displayId}`
directly, map portal-like identifiers back to the sentinel "screen:linux-portal"
(or call the previous helper such as normalizeScreenId or mapSourceToSentinel)
so that after explicit selection useScreenRecorder.ts still sees the portal-safe
id; ensure both the matchedSource present branch and the fallback branch
normalize to the sentinel when appropriate and keep the displayName unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant