Skip to content

Fixing fractional scaling issues on Wayland

Posted on:September 26, 2023

One of the most compelling advantages of using Wayland is its promise of enhanced scaling and superior high-DPI support. However, if you’ve experimented with it, particularly on Debian, you might have observed that several applications, including Firefox, Chrome, VSCode, and others, default to X11 mode. This leads to blurred font rendering when using fractional scaling.

Below are fixes for some of the applications I use daily.

Chrome

Chrome is the easiest to fix. Go to chrome://flags and search for Preferred Ozone platform. From the drop-down menu, select Wayland and restart Chrome.

Firefox

For Firefox, there are a couple of steps involved.

To fix Gnome Desktop Entry, edit sudo vim /usr/share/applications/firefox-esr.desktop. Locate the Exec line and modify it to:

Exec=env MOZ_ENABLE_WAYLAND=1 /usr/lib/firefox-esr/firefox-esr %u

To Adjusting the Launcher Script, edit sudo vim /usr/bin/firefox and modify the exec line to:

exec MOZ_ENABLE_WAYLAND=1 firefox-esr "$@"

VSCode

For VSCode, you need to instruct the underlying Electron runtime to enable Wayland, much like you would for Chrome.

Edit the file /usr/bin/code and locate the following line (it should be at the end of the file):

ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" --ms-enable-electron-run-as-node --enable-features=UseOzonePlatform --ozone-platform=wayland "$@"

Slack

Similar to Firefox, edit the Desktop Entry located at /usr/share/applications/slack.desktop and tell Electron to use Wayland:

Exec=/usr/bin/slack --ozone-platform=wayland --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer %U

Note: I haven’t tested videoconferencing, but WebRTCPipeWireCapturer should do the job.

What About IntelliJ?

Currently, there isn’t a direct fix for IntelliJ as their suite of products primarily rely on Java Swing. However, there’s a hope! The soon-to-be-released OpenJDK 21 is expected to bring support for Wayland. Yet, this would mean waiting for JetBrains to integrate these changes. For more details, check out their official announcement on the matter.

That snail-paced transition to Wayland, sigh! It’s a tad frustrating, isn’t it? For all the advancements in the Linux ecosystem, this switch appears to be taking forever. Coming from an OSX background, I can’t help but marvel at the impeccable HiDPI rendering Mac offers right out of the box. Here’s hoping Linux catches up soon!