The 2K screen on my “main” Ubuntu laptop is pin sharp but, alas, Mozilla Firefox is not!

I’m not saying the browser looks awful. It’s perfectly usable. And I reckon a fair number of you will struggle to see any issue at all.

But I do.

To my eyes, all fonts within the Firefox UI and within web content itself are blurry. Not incomprehensibly so but noticeably softer. The same is true of window controls, buttons, and other icons rendered within the app. They’re simply not as crisp or as pixel-perfect as the rest of the GNOME desktop or native GTK apps are.

I’ve no idea how “widespread” this issue is. Blurry fonts in a browser on Linux might be caused by a number of things. Plus, I do use Wayland, I do have fractional scaling enabled (125% btw), and I do run development builds of Firefox.

Either way, I found the blurry fonts jarring and wanted to fix it.

And — hurrah! — I did.

Fix Blurry Fonts in Firefox on Wayland

before and after of the fix
Before and after – though the image is compressed

Want to try the “fix” out to see the results with your open eyes?

All you need to do is run Firefox with Wayland support enabled:

  1. Open Terminal
  2. Edit the profile file: gedit ~/.profile
  3. Add new line at end: export MOZ_ENABLE_WAYLAND=1
  4. Save

Quit all running instances of Firefox (or better yet log out or reboot) then launch the browser. You should notice a different — if you don’t? Grab a magnifying glass.

But be aware there is a reason this setting is not enabled by default. I’ve heard reports of online video streaming quality being affected (and in some cases not running at all) when this value is set.

If you don’t want to permanently set an environment variable you can quit Firefox (fully) then open a new Terminal window and run the following command (or create a launcher with it):

export MOZ_ENABLE_WAYLAND=1 firefox

This change only affects the browser for the length of your session (i.e. until you close the terminal or quit Firefox).

If you use the Firefox Flatpak build you need to invoke sudo to set the variable using this command (credit: DownThePark down in the comments):

sudo flatpak override --socket=wayland --env=MOZ_ENABLE_WAYLAND=1 org.mozilla.firefox

Also Improves Touch Support, FYI

Another major upside to setting this environmental variable? It unlocks proper touchscreen support in Firefox.

Without the variable Firefox doesn’t let me use touch to scroll the page itself (I have to use the scrollbar like a luddite). Worse, trying to poke buttons/links opens a right-click context menu, and other gestures, like pinch to zoom, don’t work either.

But with this enable? I get it all. It’s like using Web/Epiphany. It’s nice!

Find Google Chrome is blurry too? You can fix it too, just not in the same way. Simply open chrome://flags/#ozone-platform-hint in a new tab, set it to ‘Auto’, then restart.

Firefox fractional scaling hidpi tips Wayland