Skip to content

fix(linux): use actual desktopCapturer source on X11#678

Open
arcenme wants to merge 2 commits into
webadderallorg:mainfrom
arcenme:fix/linux-x11-screen-capture
Open

fix(linux): use actual desktopCapturer source on X11#678
arcenme wants to merge 2 commits into
webadderallorg:mainfrom
arcenme:fix/linux-x11-screen-capture

Conversation

@arcenme

@arcenme arcenme commented Jun 13, 2026

Copy link
Copy Markdown

Description

This PR fixes Linux X11 screen recording startup by resolving the actual screen source from desktopCapturer.getSources() instead of using the Linux portal sentinel source on X11.

It also removes unused zoom region helper code that caused npm run build:linux to fail with TS6133 unused declaration errors.

Motivation

On Linux X11, Recordly can receive screen:linux-portal as the selected source. That value is not a real X11 desktopCapturer source ID.

Previously, the display media request handler treated this as a Linux portal case and returned a synthetic screen:0:0 source. On X11, this can fail with:

Failed to start recording: Could not start video source

On my X11 setup, desktopCapturer.getSources() returns valid screen sources such as:

screen:428:0
screen:427:0

Using the actual source allows recording to start correctly.

This addresses the X11 capture-source part of #364, but does not attempt to fix the AppImage toolbar/source-selector UI regression.

Type of Change

  • New Feature
  • Bug Fix
  • Refactor / Code Cleanup
  • Documentation Update
  • Other (please specify)

Related Issue(s)

Related to #364

Screenshots / Video

Screenshot (if applicable):

N/A

Video (wherever possible):

N/A

Testing Guide

Tested on Linux X11 with a multi-monitor setup.

Environment:

echo $XDG_SESSION_TYPE
# x11

echo $DISPLAY
# :1

xrandr --listmonitors
# Monitors: 2

Steps tested:

  1. Install dependencies.
npm install
  1. Run the app in development mode.
npm run dev
  1. Start a screen recording from the HUD.

Expected result:

  • Recording starts successfully.
  • No Failed to start recording: Could not start video source error appears.
  • Recording opens in the editor after stopping.
  1. Export using Legacy export mode.

Expected result:

  • Export completes successfully.
  1. Run Linux build.
npm run build:linux

Expected result:

  • Build completes successfully.
  • No TS6133 unused declaration errors from zoomRegionUtils.ts.

Checklist

  • I have performed a self-review of my code.
  • I have added any necessary screenshots or videos.
  • I have linked related issue(s) and updated the changelog if applicable.

Thank you for contributing!

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced screen capture source handling for Linux systems using Wayland display servers, improving detection and selection of the correct display for screen sharing.
  • Refactor

    • Updated tray context menu to properly display recording control options based on whether the application is actively recording.
    • Optimized zoom region utilities by reducing interpolation calculations.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

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: b6b540e1-7cc3-44db-a1c9-a5ea9f1de494

📥 Commits

Reviewing files that changed from the base of the PR and between 8c7d23d and 48dc07c.

📒 Files selected for processing (2)
  • electron/main.ts
  • src/components/video-editor/videoPlayback/zoomRegionUtils.ts

📝 Walkthrough

Walkthrough

This PR contains two independent feature changes: restructured Electron tray context menu with improved recording/non-recording state separation, and reworked Linux display media source resolution with explicit Wayland detection; additionally, internal zoom/pan transition helpers were removed from video playback utilities.

Changes

Electron Tray Menu and Linux Display Capture

Layer / File(s) Summary
Tray context menu restructuring
electron/main.ts
Tray menu template for recording vs non-recording states is rebuilt with explicit "Show Controls", "Stop Recording", "Open", and "Quit" items in a clearer ternary/array layout.
Linux display media source resolution with Wayland detection
electron/main.ts
sourceId binding is made mutable; Wayland detection gates Linux portal-sentinel handling; when sentinel screen:linux-portal is detected on Wayland, the handler clears sourceId and searches desktopCapturer sources by ID prefix before returning the chosen source's id/name pair or an empty object.

Video Zoom Region Utilities Cleanup

Layer / File(s) Summary
Remove connected zoom/pan transition helpers
src/components/video-editor/videoPlayback/zoomRegionUtils.ts
mathUtils import updated to drop cubicBezier and add easeOutZoom; removed lerp, easeConnectedPan, getLinearFocus, and getConnectedRegionTransition functions that previously supported connected pan transition interpolation and easing.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • webadderallorg/Recordly#613: Both PRs modify the Linux desktop capture routing in electron/main.ts by changing how the screen:linux-portal/Linux portal sentinel is selected and handled based on Wayland vs X11.
  • webadderallorg/Recordly#267: Both PRs overlap on Linux display-to-screen: source matching logic for resolving correct capture source IDs.
  • webadderallorg/Recordly#648: Both PRs modify zoomRegionUtils.ts to remove connected-zoom transition computation helpers like getConnectedRegionTransition.

Suggested labels

Checked

Poem

🐰 The tray now knows when records start,
Linux portals find their part,
With Wayland eyes and sources clear,
Zoom animations disappear!
Transitions fade, helpers go—
Recordly flows, nice and slow.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'fix(linux): use actual desktopCapturer source on X11' clearly and specifically describes the main fix addressing Linux X11 screen recording by using real sources instead of portal sentinels.
Description check ✅ Passed The PR description comprehensively covers all required template sections including description, motivation, type of change, related issues, testing guide, and checklist completion.
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 unit tests (beta)
  • Create PR with unit tests

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.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant