flathub / com.visualstudio.code

https://flathub.org/apps/details/com.visualstudio.code
136 stars 68 forks source link

Feature: add optional Wayland support #471

Open thatLeaflet opened 8 months ago

thatLeaflet commented 8 months ago

Currently, if I want to run VSCode in native Wayland mode, I need to either (1) launch from the terminal and pass ozone flags or (2) modify the desktop file and add those flags. Neither method is particularly good.

I propose that this this VSCode flatpak should follow in the steps of the Discord flatpak and add an optional native Wayland mode. With the Discord flatpak, it by default only comes with X11 access. But if you grant it Wayland access, it will automatically launch in native Wayland mode.

ghost commented 7 months ago

you can use flatpak override --env=<variable> <app name> to do that

thatLeaflet commented 7 months ago

I don't think there is any environmental variable to make chromium based stuff to use Wayland (unlike Firefox which has MOZ_ENABLE_WAYLAND=1).

As far as I'm aware, the only options for Chromium are inside the program (menu isn't available in VSCode), through a config file (which VSCode doesn't read without a patch), or from the command line.

westurner commented 4 months ago

This seems to fix the blurry fonts with Wayland instead of X:

flatpak --socket=wayland run com.visualstudio.code --enable-features=UseOzonePlatform --ozone-platform=wayland
westurner commented 4 months ago

Here's my .desktop file, which supersedes the system com.visualstudio.code.desktop; note the --enable-features=UseOzonePlatform --ozone-platform=wayland added to both Exec=s.

$ cat ~/.local/share/applications/com.visualstudio.code.desktop 
[Desktop Entry]
Name=Visual Studio Code
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=code --file-forwarding --socket=wayland com.visualstudio.code --enable-features=UseOzonePlatform --ozone-platform=wayland --reuse-window @@ %F @@
Icon=com.visualstudio.code
Type=Application
StartupNotify=true
StartupWMClass=Code
Categories=TextEditor;Development;IDE;
MimeType=text/plain;inode/directory;application/x-code-workspace;
Actions=new-empty-window;
Keywords=vscode;
X-Flatpak-Tags=proprietary;
X-Flatpak=com.visualstudio.code

[Desktop Action new-empty-window]
Name=New Empty Window
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=code --file-forwarding --socket=wayland com.visualstudio.code --enable-features=UseOzonePlatform --ozone-platform=wayland --new-window @@ %F @@
Icon=com.visualstudio.code
akvadrako commented 1 month ago

You can set the environmental variable ELECTRON_OZONE_PLATFORM_HINT=auto and enable the wayland socket, and VSCode will use wayland.

tazihad commented 2 weeks ago

thanks. this worked for me.

flatpak override --user --socket=wayland --socket=fallback-x11  --env=ELECTRON_OZONE_PLATFORM_HINT=auto com.visualstudio.code