Enable Mozilla Firefox and Thunderbird on Wayland in Ubuntu 20.04

Turn on Wayland fractional scaling on Ubuntu 20.04 and make Firefox and Thunderbird render natively instead of going through XWayland.

This guide walks through turning on Wayland fractional scaling (FS) on Ubuntu 20.04 and then pointing Firefox and Thunderbird at it natively.

Wayland

At the time of writing Ubuntu counted Wayland users as “less than 1%”1. Feel special.

Enable

Follow https://linuxconfig.org/how-to-enable-disable-wayland-on-ubuntu-20-04-desktop.

Test

GUI. Settings -> About -> Windowing system.

CLI. Check whether your current session is a Wayland one2:

# Check your session ID
$ loginctl
$ loginctl show-session <SESSION_ID> -p Type

# or as a one-liner
$ loginctl show-session $(awk '/tty/ {print $1}' <(loginctl)) -p Type | awk -F= '{print $2}'

For example:

$ loginctl
SESSION  UID USER       SEAT  TTY
     12 1000 user       seat0 tty2

1 sessions listed.

$ loginctl show-session 12 -p Type
Type=wayland

Fractional scaling

To enable Wayland FS:

$ gsettings set org.gnome.mutter experimental-features \
    "['scale-monitor-framebuffer', 'x11-randr-fractional-scaling']"

Log out and back in (or reboot). Displays -> Scaling now offers 100%, 125%, 150%, 175%, and 200%.

Firefox and Thunderbird on Wayland

Test it once

Firefox opens in X11 mode by default, which makes fonts blurry under fractional scaling. Run it once in Wayland mode:

$ MOZ_ENABLE_WAYLAND=1 firefox

Verify

Open about:support and check Window protocol under Graphics / Features. It reads x11 under XWayland and wayland as a native Wayland client3.

Make it the default

Copy the .desktop file into your user directory and patch it:

$ cp /usr/share/applications/firefox.desktop ~/.local/share/applications/firefox.desktop
$ sed -i 's/Exec=firefox/Exec=env MOZ_ENABLE_WAYLAND=1 firefox/g' \
    ~/.local/share/applications/firefox.desktop

Same drill for Thunderbird:

$ MOZ_ENABLE_WAYLAND=1 thunderbird
$ cp /usr/share/applications/thunderbird.desktop ~/.local/share/applications/thunderbird.desktop
$ sed -i 's/Exec=thunderbird/Exec=env MOZ_ENABLE_WAYLAND=1 thunderbird/g' \
    ~/.local/share/applications/thunderbird.desktop

Debugging a .desktop file

$ sudo apt install dex
$ dex ~/.local/share/applications/firefox.desktop
Built with Hugo
Theme Stack designed by Jimmy