microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.37k stars 28.93k forks source link

XWayland is still required to run as a native Wayland client #176192

Open myownfriend opened 1 year ago

myownfriend commented 1 year ago

Does this issue occur when all extensions are disabled?: Yes

Steps to Reproduce:

  1. Run VSCode with code --enable-features=UseOzonePlatform --ozone-platform=wayland

I am positive that it's running as a native Wayland client. Xeyes isn't showing it to be an X11 window and the application looks sharp on my monitor with DPI scaling which isn't the case with XWayland window. However, anytime I launch it, XWayland launches, too. If I kill XWayland, VSCode closes, too. No other Wayland applications are effected.

This could be an issue with Electron but I don't have any other Electron applications to test it with.

deepak1556 commented 1 year ago

Is this an rpm or snap installation ?

myownfriend commented 1 year ago

Is this an rpm or snap installation ?

It's an RPM installation.

wooque commented 1 year ago

Same here on Debian 12 with GNOME 43.3. VS Code launches XWayland even when it's running as native Wayland window, and also crashes if Xwayland is killed. But when I marked Xwayland as non-executable, VS Code starts just fine even if it can't start Xwayland.

myownfriend commented 1 year ago

I'm now on Fedora 38 and Gnome 44 and the same issue still happens. Just figured I'd provide that info.

truongan commented 1 year ago

I just tried out sway and ran into this problem as well. So it's just my 2 cents that this is not a Gnome thing.

myownfriend commented 1 year ago

This is definitely an electron issue. The same behavior also happens with Discord.

nocnoc94 commented 8 months ago

Still an issue on fedora 39 with gnome

nocnoc94 commented 8 months ago

I solved the issue, here are the instructions for fedora gnome

First copy the desktop file

cp /usr/share/applications/code.desktop ~/.local/share/applications/

Then add additional arguments to the desktop file

[Desktop Entry]
Name=Visual Studio Code
Comment=Code Editing. Redefined.
GenericName=Text Editor
# Exec=/usr/share/code/code --unity-launch %F
Exec=/usr/share/code/code --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform-hint=auto --unity-launch %F
myownfriend commented 8 months ago

First copy the desktop file

cp /usr/share/applications/code.desktop ~/.local/share/applications/

Is this part absolutely necessary because just doing the second part didn't do anything differently

andrepg commented 4 months ago

I solved the issue, here are the instructions for fedora gnome

First copy the desktop file

cp /usr/share/applications/code.desktop ~/.local/share/applications/

Then add additional arguments to the desktop file

[Desktop Entry]
Name=Visual Studio Code
Comment=Code Editing. Redefined.
GenericName=Text Editor
# Exec=/usr/share/code/code --unity-launch %F
Exec=/usr/share/code/code --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform-hint=auto --unity-launch %F

Just to add my two cents:

  1. Installing using tar file from VSCode homepage
  2. Using Silveblue, so instead of /usr/share/applications I need to copy the .desktop file to inside ~/.local/share/applications
  3. The magic line is Exec=/path/to/code --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform-hint=auto --unity-launch %F
  4. update-desktop-database with my local .desktop folders as parameter and that's it!

Ps.: Note that paths used here may not fit entirely another's SO and could need some adjustment.