fix(linux): use a real screen source on X11 instead of the portal sen…#768
Open
maxmedina05 wants to merge 1 commit into
Open
fix(linux): use a real screen source on X11 instead of the portal sen…#768maxmedina05 wants to merge 1 commit into
maxmedina05 wants to merge 1 commit into
Conversation
…tinel The Linux HUD does not render a source picker, so `getSelectedSource()` is always null when recording starts. startRecording then substituted the `screen:linux-portal` sentinel for every Linux session, forcing capture through getDisplayMedia and the xdg-desktop-portal ScreenCast dialog. On X11 that dialog never opens, so capture failed with: Failed to start recording: Could not start video source Main already resolves screens per session type via getScreenSourceIdForDisplay(): the portal sentinel on Wayland, a real desktop-capturer id on X11. The renderer just never asked for it. Prefer a real screen id when one is available and keep the sentinel as the fallback, so Wayland behaviour is unchanged and X11 uses direct capture. Fallback ids (screen:fallback:*) are skipped so the existing "Selected display is not available" guard still applies. Verified on Ubuntu 24.04 (GNOME, X11): resolution now yields a real source id and captures at 3840x2160@60. Refs webadderallorg#137, webadderallorg#364, webadderallorg#441 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughLinux recording now queries available screen sources, selects the first captureable real source, and falls back to the portal sentinel when resolution fails or no suitable source exists. ChangesLinux source selection
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The Linux HUD renders no source picker, so
getSelectedSource()is always null when recording starts.startRecordingthen substitutes thescreen:linux-portalsentinel for every Linux session, forcing capture throughgetDisplayMediaand the xdg-desktop-portal ScreenCast dialog. On X11 that dialog never opens, so recording fails withCould not start video source.Main already resolves screens correctly per session type via
getScreenSourceIdForDisplay()— the portal sentinel on Wayland, a real desktop-capturer id on X11. The renderer just never asked for it. This addsresolveDefaultLinuxSource(), which prefers a real screen id when available and keeps the sentinel as fallback.Part of a series of Linux fixes for Ubuntu 24.04; each PR is standalone and touches disjoint files.
Motivation
X11 users cannot record at all — capture fails immediately with
Could not start video source, confirmed by #137. Wayland is unaffected today and stays unaffected here: it still resolves to the portal sentinel and the single-dialog flow. Only X11 changes, moving to direct capture with a real source id. Fallback ids (screen:fallback:*) are skipped so the existing "Selected display is not available" guard still applies.Type of Change
Related Issue(s)
Refs #137, #364, #441
Screenshots / Video
Not a UI change — the observable difference is that recording starts instead of throwing. On X11, source resolution now yields a real id (e.g.
screen:661:0) and capture begins; before, it threwCould not start video sourcebefore any frame.Testing Guide
npx vitest --run npm run dev # on a Linux X11 session, press record without picking a source — it should recordVerified on Ubuntu 24.04 (GNOME, X11): resolves a real source id and captures at 3840x2160@60 from a fresh profile with no source selected. Wayland unchanged — still resolves to the portal sentinel.
Note:
resolveDefaultLinuxSourceis module-private and depends onwindow.electronAPI, so a unit test means exporting it and mocking that. Happy to add if wanted.Checklist
Notes
Investigated and drafted with Claude Code. The error message and the X11/Wayland behaviour described are from real runs on the hardware listed, not generated — I can re-run either on request.
Thank you for contributing!
Summary by CodeRabbit
New Features
Bug Fixes