How I Fixed My Blurry Firefox on HiDPI + Wayland
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. Heck, I reckon a fair number of people would struggle to see any issue at all.
But I do.
To my eyes, all fonts within the UI and within web content are slightly blurry. Not incomprehensibly so but they are noticeably softer. The same is true of window controls, buttons, and other icons rendered in the browser. They do not appear as crisp or as pixel-perfect as the rest of the GNOME desktop or native GTK apps.
Now, I’ve no idea how “widespread” this issue is as blurry fonts in a browser on Linux could 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.
Thankfully it is easy.
Fix Blurry Fonts in Firefox on Wayland
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:
- Open Terminal
- Edit the profile file:
gedit ~/.profile
- Add new line at end:
export MOZ_ENABLE_WAYLAND=1
- 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).
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.