fix(linux): resolve X11 recording overlay input issues#518
Conversation
📝 WalkthroughWalkthroughThis PR refines Linux/Wayland support across screen capture and HUD overlay features. The display media handler now gates portal sentinel detection on the Wayland session type, and the HUD overlay gains Linux-specific sizing, positioning, and mouse passthrough behavior. ChangesLinux Platform Support Refinements
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
There was a problem hiding this comment.
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)
electron/windows.ts (1)
259-271:⚠️ Potential issue | 🟠 Major | ⚡ Quick winThe new Linux passthrough branch is unreachable.
Line 261 returns early whenever
isHudOverlayMousePassthroughSupported()is false, and that helper hard-codesfalseon Linux at Line 119. That means Lines 267-270 never run,get-hud-overlay-mouse-passthrough-supportedstill reports unsupported, and the HUD stays insetIgnoreMouseEvents(false)on Linux.🤖 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/windows.ts` around lines 259 - 271, The handler for "hud-overlay-set-ignore-mouse" returns early when isHudOverlayMousePassthroughSupported() is false, which prevents the Linux-specific branch from running; change the logic so we don't return early but instead call hudOverlayWindow.setIgnoreMouseEvents(true) for Linux and, for other platforms, call setIgnoreMouseEvents(true, { forward: true }) only when isHudOverlayMousePassthroughSupported() is true (otherwise call setIgnoreMouseEvents(true) as a safe fallback); update the ipcMain.on handler around isHudOverlayMousePassthroughSupported(), the ignore-branch that currently branches on process.platform === "linux", and the fallback setIgnoreMouseEvents(false) call so Linux path is reachable and get-hud-overlay-mouse-passthrough-supported reflects actual behavior.
🤖 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/windows.ts`:
- Around line 188-197: The Linux branch always recenters the HUD ignoring
hudUserPosition—preserve and reuse the saved position when valid. In the Linux
branch (where width/height are set) check if hudUserPosition exists and is
within the current workArea bounds (clamp if necessary), and return bounds using
hudUserPosition.x/hudUserPosition.y with the computed width/height instead of
forcing center; otherwise fall back to the centered x/y. Ensure this fixes
subsequent applyHudOverlayBounds() calls by returning the persisted position
when present.
---
Outside diff comments:
In `@electron/windows.ts`:
- Around line 259-271: The handler for "hud-overlay-set-ignore-mouse" returns
early when isHudOverlayMousePassthroughSupported() is false, which prevents the
Linux-specific branch from running; change the logic so we don't return early
but instead call hudOverlayWindow.setIgnoreMouseEvents(true) for Linux and, for
other platforms, call setIgnoreMouseEvents(true, { forward: true }) only when
isHudOverlayMousePassthroughSupported() is true (otherwise call
setIgnoreMouseEvents(true) as a safe fallback); update the ipcMain.on handler
around isHudOverlayMousePassthroughSupported(), the ignore-branch that currently
branches on process.platform === "linux", and the fallback
setIgnoreMouseEvents(false) call so Linux path is reachable and
get-hud-overlay-mouse-passthrough-supported reflects actual behavior.
🪄 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: 4fb0c7cf-0e4d-48f4-8e83-8d8a91e9689a
📒 Files selected for processing (2)
electron/main.tselectron/windows.ts
| if (process.platform === "linux") { | ||
| const width = 520; | ||
| const height = 220; | ||
|
|
||
| return { | ||
| width, | ||
| height, | ||
| x: Math.round(workArea.x + (workArea.width - width) / 2), | ||
| y: workArea.y + workArea.height - 240, | ||
| }; |
There was a problem hiding this comment.
Preserve the dragged HUD position before recentering on Linux.
This branch always recenters the HUD and ignores hudUserPosition, so any later applyHudOverlayBounds() call snaps a dragged HUD back to bottom-center even when the saved position is still valid.
Suggested fix
if (process.platform === "linux") {
const width = 520;
const height = 220;
+
+ if (hudUserPosition) {
+ return {
+ x: hudUserPosition.x,
+ y: hudUserPosition.y,
+ width,
+ height,
+ };
+ }
return {
width,
height,
x: Math.round(workArea.x + (workArea.width - width) / 2),
y: workArea.y + workArea.height - 240,
};
}🤖 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/windows.ts` around lines 188 - 197, The Linux branch always
recenters the HUD ignoring hudUserPosition—preserve and reuse the saved position
when valid. In the Linux branch (where width/height are set) check if
hudUserPosition exists and is within the current workArea bounds (clamp if
necessary), and return bounds using hudUserPosition.x/hudUserPosition.y with the
computed width/height instead of forcing center; otherwise fall back to the
centered x/y. Ensure this fixes subsequent applyHudOverlayBounds() calls by
returning the persisted position when present.
Description
Fixes Linux/X11 recording usability issues caused by the fullscreen transparent HUD overlay behavior.
Motivation
On Linux/X11, the transparent fullscreen HUD overlay could intercept pointer input across the entire screen during recording.
This caused:
The issue was reproducible on Linux Mint (X11).
Type of Change
Related Issue(s)
N/A
Screenshots / Video
fixed.1.mp4
Before
After
Testing Guide
Environment:
Test steps:
Run the app with:
Start a screen recording
Verify:
Implementation Notes
Linux-specific HUD bounds
Linux now uses compact HUD overlay bounds instead of a fullscreen transparent overlay window.
This avoids X11 compositors treating the overlay as a fullscreen input-intercepting window.
Platform-specific mouse forwarding
Linux now avoids:
while preserving the existing behavior for Windows/macOS.
Wayland portal handling
Improves Linux portal sentinel detection by ensuring the fallback path only applies on Wayland sessions.
Checklist
Summary by CodeRabbit