Skip to content

Simplify screen source selection to fix Wayland compatibility#2207

Open
IsmaelMartinez wants to merge 7 commits intomainfrom
claude/fix-thumbnail-window-issue-G9geO
Open

Simplify screen source selection to fix Wayland compatibility#2207
IsmaelMartinez wants to merge 7 commits intomainfrom
claude/fix-thumbnail-window-issue-G9geO

Conversation

@IsmaelMartinez
Copy link
Owner

Summary

Simplified the screen source selection flow by removing the redundant desktopCapturer.getSources() call and using the source directly from the picker. This resolves reliability issues on Wayland where desktopCapturer is unreliable.

Key Changes

  • Removed desktopCapturer import from electron dependencies
  • Removed findSelectedSource() helper function
  • Simplified handleScreenSourceSelection() to directly use the source passed from the picker instead of re-querying all sources
  • Removed error handling for desktopCapturer failures (no longer needed)
  • Removed setImmediate retry logic that was working around the unreliable source lookup

Implementation Details

The previous implementation would call desktopCapturer.getSources() to retrieve all available sources, then search through them to find the one matching the user's selection. On Wayland, this call is unreliable and can fail, preventing the thumbnail window from being created.

The new implementation trusts that the source object passed from the picker is already valid and uses it directly. This eliminates the problematic desktopCapturer call while maintaining the same functionality.

Fixes issue #2204.

https://claude.ai/code/session_013t3ThsGo83tvcRQzc38dq8

…humbnail on Wayland (#2204)

The handleScreenSourceSelection function was calling desktopCapturer.getSources()
a second time to re-verify the source already selected from the picker. On Wayland,
this redundant call can fail or return mismatched source IDs, preventing both the
thumbnail preview window from being created and screen sharing from starting.

The source from the picker already has a valid ID from desktopCapturer.getSources()
and can be used directly for both the thumbnail setup and the Electron callback.

https://claude.ai/code/session_013t3ThsGo83tvcRQzc38dq8
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @IsmaelMartinez, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the robustness of screen sharing, particularly for users on Wayland, by refactoring the screen source selection process. The core change involves trusting the source object directly from the picker, thereby eliminating an unreliable desktopCapturer.getSources() call that caused failures and prevented the screen sharing thumbnail window from appearing. This simplification enhances stability and removes unnecessary complexity.

Highlights

  • Simplified Screen Source Selection: The logic for selecting a screen source has been streamlined by removing the redundant desktopCapturer.getSources() call, directly utilizing the source provided by the picker.
  • Wayland Compatibility Fix: This change resolves reliability issues on Wayland where the desktopCapturer API is known to be unreliable, preventing the thumbnail window from being created.
  • Code Cleanup: Removed the desktopCapturer import, the findSelectedSource() helper function, and associated error handling and setImmediate retry logic that worked around previous desktopCapturer unreliability.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • app/mainAppWindow/index.js
    • Removed the desktopCapturer module from Electron imports.
    • Eliminated the findSelectedSource helper function.
    • Refactored the handleScreenSourceSelection function to directly use the provided source object.
    • Removed error handling and setImmediate retry logic related to desktopCapturer failures.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link
Contributor

✅ Changelog entry generated and committed to this PR:

Simplify screen source selection to fix Wayland compatibility - by @IsmaelMartinez (#2207)

The file .changelog/pr-2207.txt will be included when you merge this PR.

You can edit it directly in this PR if needed.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request simplifies the screen source selection logic to improve reliability on Wayland by removing a redundant desktopCapturer.getSources() call. The changes are clear and effectively address the described issue. However, I've identified a potential issue where error handling was removed during the simplification, which could lead to an unresponsive UI if an error occurs while setting up the screen share. I've provided a suggestion to re-introduce the error handling in a way that is consistent with the rest of the codebase.

Wrap setupScreenSharing/callback in try-catch to prevent hung UI if an
error occurs during preview window creation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 20, 2026

📦 PR Snap Build Artifacts

Snap builds successful! Download artifacts:

🐧 Linux Snap Packages

x86_64 (107.26 MB)

arm64 (104.18 MB)

armv7l (98.41 MB)


📝 Note: Other package formats (.deb, .rpm, .AppImage, .dmg, .exe) are built in the main workflow

View workflow run

@github-actions
Copy link
Contributor

github-actions bot commented Feb 20, 2026

📦 PR Build Artifacts

Build successful! Download artifacts:

🐧 Linux

x86_64 (433.99 MB) - Contains: .deb, .rpm, .tar.gz, .AppImage

arm64 (425.23 MB) - Contains: .deb, .rpm, .tar.gz, .AppImage

armv7l (403.28 MB) - Contains: .deb, .rpm, .tar.gz, .AppImage

🍎 macOS

x86_64 (124.81 MB) - Contains: .dmg

🪟 Windows

x86_64 (105.41 MB) - Contains: .exe installer


📝 Note: Snap packages (.snap) are built in a separate workflow

View workflow run

🕐 Last updated: 2026-03-09 16:49 UTC

* fix: prevent app crash when proxy connection fails (#2205)

The top-level uncaughtException/unhandledRejection handlers added in
v2.7.6 (security hardening phase 1) call process.exit(1) on any
unhandled error. When a proxy is configured via config.json and the
tunnel fails, window.loadURL() rejects with ERR_TUNNEL_CONNECTION_FAILED.
This promise was not awaited/caught in ConnectionManager.refresh(),
causing an unhandled rejection that triggered the fatal handler.

Three changes fix this:
- Await and catch the loadURL() promise in ConnectionManager.refresh()
  so proxy failures trigger a retry instead of an unhandled rejection
- Expand the did-fail-load handler to recover from proxy/tunnel errors
  (ERR_TUNNEL_CONNECTION_FAILED, ERR_PROXY_CONNECTION_FAILED, etc.)
  in addition to the existing ERR_INTERNET_DISCONNECTED handling
- Make the top-level error handlers skip process.exit(1) for known
  network error patterns as a safety net

Closes #2205

https://claude.ai/code/session_01UDNMHvEP2TnazmHUU7uusz

* chore: add changelog entry for PR #2206

* fix: address PR review comments for error handler robustness

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
IsmaelMartinez added a commit that referenced this pull request Feb 23, 2026
Key corrections from multi-agent review:

- Confirm root cause via Chromium source: DesktopCapturer::IsRunningUnderWayland()
  checks XDG_SESSION_TYPE/WAYLAND_DISPLAY independently of --ozone-platform
- Add Option F: --disable-features=WebRTCPipeWireCapturer when isX11Forced as
  the most targeted fix (short-circuits PipeWire before env var check)
- Fix investigation step 1 location: getSources() failure is in service.js
  #handleGetDesktopCapturerSources, not handleScreenSourceSelection
- Document sendScreenSharingStarted(null) preload guard bug dropping IPC events
- Fix audit Near-Term Priority: setDisplayMediaRequestHandler already exists;
  --disable-features=WebRTCPipeWireCapturer is the correct next step
- Soften #2222 characterization to require debug logs rather than speculation
- Note PR #2207 (redundant getSources() removal) as correct complementary fix
- Add Chromium source and Electron upstream issue references

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
claude added 3 commits March 4, 2026 11:58
Took the incoming main version which adds handling for 'Object has been destroyed'
and 'Script failed to execute' transient errors.

https://claude.ai/code/session_013t3ThsGo83tvcRQzc38dq8
This changelog was pulled in from a previous main merge and doesn't
belong on this feature branch.

https://claude.ai/code/session_013t3ThsGo83tvcRQzc38dq8
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2026

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

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants