Native wayland support is now working consistently for me in VSCode, giving much better text rendering. Unfortunately, it's still hidden behind some command-line flags.
By adding some files to /usr/local/*
, you can ensure that VSCode always launches with these flags.
Assuming that the VSCode launcher is /usr/bin/code-oss
(as is the case in Arch):
- Create
/usr/local/bin/code-oss
with the following content:
#!/bin/sh
exec /usr/bin/code-oss --enable-features=UseOzonePlatform --ozone-platform=wayland "$@"
chmod a+x /usr/local/bin/code-oss
- In
/usr/local/share/applications/
, create modified versions of any vscode entries in/usr/share/applications/*.desktop
, which is where many launchers get their application info. Add the new flags to theExec=
lines, e.g. for Arch:
sudo mkdir -p /usr/local/share/applications/
for f in code-oss code-oss-url-handler; do
sed -E 's:^(Exec=[^ ]+)(.*)$:\1 --enable-features=UseOzonePlatform --ozone-platform=wayland\2:' < /usr/share/applications/$f.desktop | sudo tee /usr/local/share/applications/$f.desktop
done
- If your distro provides simlinks to the "real" vscode launcher, like
code
to launchcode-oss
, override those too:
ln -s /usr/local/bin/code-oss /usr/local/bin/code
- restart your application launcher
- for Gnome:
update-desktop-database /usr/local/share/applications
- for Gnome:
- ensure that your
$PATH
includes/usr/local/bin
somewhere before/usr/bin
- check that
/usr/local/bin/code-oss
is executable
If you use Fedora or Ubuntu (or really just GNOME in general), I recommend installing Main Menu on flathub. Navigate to Visual Studio Code (or to your favorite alternative, like VSCodium) and edit the command as such:
/usr/share/code/code --enable-features=UseOzonePlatform --ozone-platform=wayland %F
Apply this to any other entries as well, like the "new window" entry:
/usr/share/code/code --new-window --enable-features=UseOzonePlatform --ozone-platform=wayland %F
And don't forget to press save.