microsoft / vscode

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

Native wayland support with newest electron #109176

Closed toger5 closed 2 years ago

toger5 commented 4 years ago

Native wayland support would be great to run vs code without XWayland as described in https://github.com/microsoft/vscode/issues/77752.

Recently electron merged the chrome version with the ozone backend needed: https://github.com/electron/electron/pull/26022

This would allow for:

abraxxa commented 2 years ago

Yes, this an the version specific electron17-flags.conf. I've tried ~/.config/chrome-flags.conf as well, was ignored as well.

kevindumanoir commented 2 years ago

I got the same issue as @slagiewka with a 150% scaling. The same issue happens when you relaunch Chrome while keeping active tabs.

noahtallen commented 2 years ago

On Fedora 36 + Sway, code --ozone-platform=wayland successfully launches VS Code in Wayland (no need for the other flags), but it seems we are still waiting on #134612 and its PR #135191 for a global configuration.

One way to work around this is to copy the code.desktop file from /usr/share/applications to ~/.local/share/applications, and set the Exec line to Exec=/usr/share/code/code --ozone-platform=wayland --unity-launch %F. Then Code opens using Wayland when running it via the quick launcher. (Note that the file paths might be different depending on the OS; this is for Fedora.)

Once Code is already running from an app launcher, the code CLI command will work with Wayland. Even when code ./path/to/dir opens a directory in a new window, that new window runs Wayland as long as you've already opened code from a launcher.

I don't think this issue is really fixed until VS Code is natively using Wayland by default if it's available.

bacteriostat commented 2 years ago

The flag --ozone-platform-hint needs to be added to electron from chromium (https://github.com/electron/electron/issues/33810) and then electron apps can automatically launch on X11/Wayland based on the current session.