vscode icon indicating copy to clipboard operation
vscode copied to clipboard

fix: improve Wayland detection and environment setup

Open omarionnn opened this issue 10 months ago • 3 comments

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 avatar Feb 15 '25 02:02 omarionnn