Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve Wayland detection and environment setup #240864

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

omarionnn
Copy link

Overview
This PR fixes the Wayland detection and environment setup issues when launching browsers through xdg-open in VS Code.

Issue
When running xdg-open commands from VS Code's integrated terminal under Wayland sessions, users encounter the error:
"Failed to open Wayland display, fallback to X11"

Fixes #229096

Changes

  • Fixed Wayland socket path detection by using correct XDG_RUNTIME_DIR path
  • Added proper GDK_BACKEND environment setup
  • Added Wayland-specific environment variables for browser compatibility
  • Maintained X11 fallback when Wayland is not available

Testing Notes
This change requires a Linux system running a Wayland session to test. I have tested the changes on Fedora 40 with:

  • Wayland session (XDG_SESSION_TYPE=wayland)
  • VS Code 1.91.1
  • Firefox as default browser

The fix can be verified by:

  1. Running VS Code in a Wayland session
  2. Opening the integrated terminal
  3. Running xdg-open https://www.google.es
  4. Verifying the browser opens without the "Failed to open Wayland display" error

@omarionnn
Copy link
Author

omarionnn commented Feb 15, 2025 via email

@omarionnn
Copy link
Author

omarionnn commented Feb 15, 2025 via email

Copy link

@Feroslav268 Feroslav268 left a comment

Choose a reason for hiding this comment

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

  • ~~~~

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.

3 participants