Microsoft/vscode

Warning when running in vscode terminal 'xdg-open "https://..."'

Open

#223.591 aperta il 25 lug 2024

Vedi su GitHub
 (5 commenti) (1 reazione) (1 assegnatario)TypeScript (10.221 fork)batch import
buggood first issuelinuxsnapterminalwayland

Metriche repository

Star
 (74.848 star)
Metriche merge PR
 (Merge medio 11h 43m) (1000 PR mergiate in 30 g)

Descrizione

Similar issue was closed at: https://github.com/microsoft/vscode/issues/213004 with no resolution.

In my case, firefox is open indirectly by xdg-open "https://www.google.es" (for instance). And I got the message Error: Failed to open Wayland display, fallback to X11. WAYLAND_DISPLAY='wayland-0' DISPLAY=':0'

Does this issue occur when all extensions are disabled?: (Yes/No) IDK

  • VS Code Version: 1.91.1

  • OS Version: Linux x64 6.9.9-200.fc40.x86_64

  • Commit: f1e16e1e6214d7c44d078b1f0607b2388f29d729

  • Date: 2024-07-09T22:08:12.169Z

  • Electron: 29.4.0

  • ElectronBuildId: 9728852

  • Chromium: 122.0.6261.156

  • Node.js: 20.9.0

  • V8: 12.2.281.27-electron.0

Steps to Reproduce:

  1. Use a wayland session.
  2. Start vscode.
  3. Open the terminal window inside vscode.
  4. Run xdg-open https://www.google.es

I have observed the situation does not happen when I run:

export GDK_BACKEND=wayland
xdg-open "https://www.google.es"

the previous value was GDK_BACKEND=x11.

Maybe the environment variable XDG_SESSION_TYPE can be used to decide the value of GDK_BACKEND and set it according to the type of session.


I have observed from https://github.com/microsoft/vscode/blob/64b7b6d9797b4f9a2f33d1f237b16542a45536b1/resources/linux/snap/electron-launch#L139 that the value for wayland_enabled is false, after run that block (I am using vscode installed from RPM).

I got the below isolating the execution (running from a vscode terminal):

$ bash -xv test.wayland.sh 
#!/bin/bash
# From: https://github.com/microsoft/vscode/blob/64b7b6d9797b4f9a2f33d1f237b16542a45536b1/resources/linux/snap/electron-launch#L139
wayland_available=false
+ wayland_available=false
if [[ -n "$XDG_RUNTIME_DIR" && -z "$DISABLE_WAYLAND" ]]; then
    wdisplay="wayland-0"
    if [ -n "$WAYLAND_DISPLAY" ]; then
        wdisplay="$WAYLAND_DISPLAY"
    fi
    wayland_sockpath="$XDG_RUNTIME_DIR/../$wdisplay"
    wayland_snappath="$XDG_RUNTIME_DIR/$wdisplay"
    if [ -S "$wayland_sockpath" ]; then
        # if running under wayland, use it
        #export WAYLAND_DEBUG=1
        # shellcheck disable=SC2034
        wayland_available=true
        # create the compat symlink for now
        if [ ! -e "$wayland_snappath" ]; then
            ln -s "$wayland_sockpath" "$wayland_snappath"
        fi
    fi
fi
+ [[ -n /run/user/1001 ]]
+ [[ -z '' ]]
+ wdisplay=wayland-0
+ '[' -n wayland-0 ']'
+ wdisplay=wayland-0
+ wayland_sockpath=/run/user/1001/../wayland-0
+ wayland_snappath=/run/user/1001/wayland-0
+ '[' -S /run/user/1001/../wayland-0 ']'

echo "wayland_available='$wayland_available'"
+ echo 'wayland_available='\''false'\'''
wayland_available='false'

The path checked for wayland_sockpath does not exist, but it exists wayland_snappath.

HTH

Guida contributor