HiDPI on Linux

About

These are reference notes of my personal experiences getting HiDPI screens working on my Linux systems with Gnome shell and Wayland. This is not intended as a general guide covering all use-cases, though I’m sharing it in case it helps anyone else.

Gnome desktop

Gnome natively supports integer scaling (100%, 200%, 400%, etc) out of the box. On my displays this wasn’t granular enough so I had to enable fractional scaling as well: gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"

Technical limitations

Fractional scaling on GNOME uses oversampling, which means rendering at a higher resolution, then scaling down with integer scaling, and is true for both Wayland and Xorg sessions. This brings higher GPU and CPU (since GTK is not fully hardware accelerated) usage, more power consumption, and in some cases significantly slower responsiveness, particularly noticeable in Xorg.

Enabling fractional scaling can also result in blur for legacy applications using XWayland, even if only integer scales are used, because the rendering method changes.

QT

QT applications adopted Gnome’s fractional scaling settings automatically for me.

Firefox

Firefox (and Thunderbird) required exporting MOZ_ENABLE_WAYLAND=1 from /etc/profile.

(If installed via Flatpak instead, this would be: flatpak override --socket=wayland --env=MOZ_ENABLE_WAYLAND=1 org.mozilla.firefox)

Chrome and electron apps

On Chrome I had to set chrome://flags/#ozone-platform-hint to auto.

On Electron apps I had to specify the following extra command arguments: --enable-features=UseOzonePlatform --ozone-platform=wayland.
I incorporated this into my dotfiles using patch-electron-desktop-files

See also