I recently bought a new laptop and installed a fresh Ubuntu! (Ubuntu 22.04.1 LTS). But due to Wayland the Electron apps (in my case Chrome and VSCode) do not support scaling.
I often search for fixes online, but could not find a fix at first. But a week later I fortunately stumbled upon the answers!
Chrome
The fix for chrome is to install the unstable version:
sudo apt install google-chrome-unstable
And alter the desktop launch file to make sure it starts with the arguments as provide in this post:
sudo code /usr/share/applications/google-chrome-unstable.desktop
Make sure the execute reads the following:
Exec=/usr/bin/google-chrome-unstable %U -enable-features=UseOzonePlatform -ozone-platform=wayland
Visual Studio Code
For vscode we follow a similar approach, but we do not have to install an unstable version. Open the desktop file.
sudo code /usr/share/applications/code.desktop
Make sure the execute line under [Desktop Entry] reads:
Exec=/usr/share/code/code --unity-launch %F --enable-features=UseOzonePlatform --ozone-platform=wayland --log debug
And under [Desktop Action new-empty-window] reads:
Exec=/usr/share/code/code --new-window %F --enable-features=UseOzonePlatform --ozone-platform=wayland --log debug
I often start vscode from a terminal, and that has not the arguments that we added in the *.desktop files by default. Therefore I created an alias in my ~/.zshrc (Yes, I used zsh).
alias code='f() {/usr/bin/code $@ --enable-features=UseOzonePlatform --ozone-platform=wayland};f'
now, when launching code it launches it with the correct parameters.
Last step is to fix the titlebar again, in vscode:
ctrl + shift + p
Open the settings in JSON and add:
"window.titleBarStyle": "custom"
Geef een reactie