[How to] Wayland Firefox and Thunderbird under KDE or GNOME

Good day to all.

I was thinking about creating a small tutorial for Wayland users to get Firefox and Thunderbird to fully use Wayland. Among other things for KDE use how to integrate Firefox almost in KDE. Both programs run absolutely stable under KDE.

So we start simple. This is more for advanced users.

In Firefox, type about:support to see what mode Firefox is running in. Scroll down until you find Window-Protokoll. Most of them should say Xwayland.

If you have Wayland as default, we first set the environment variable with any text editor as follows:

sudo nano /etc/environment

Then save and restart the computer.

Now we check the whole thing, it should look like on the screenshots:

Source I got from Arch Wiki: Firefox - ArchWiki

To make Firefox use KDE windows again, we type about:config confirm that we are careful and change the following values:

widget.use-xdg-desktop-portal.mime-handler >> 1

widget.use-xdg-desktop-portal.file-picker >> 1

We restart Firefox and ready it looks like this when downloading a file for example:

You have the normal KDE windows in front of your eyes again. Also taken from the Arch Wiki: Firefox - ArchWiki

So since I switched Firefox and Thunbderbird to Wayland, these two programs run really stable and smooth. Even web pages load much much faster. I was amazed myself what such settings can do. I wish a lot of fun trying and testing, and a nice weekend to you all.

With love and gratitude. :pray:

1 Like

If I do that using an UHD monitor, resolution of 3840 x 2160 AND scaling 150%,
the last window size is not saved in GNOME, except for the maximum window size.
It defaults to something smaller…

I don’t know, I don’t use Gnome. However, it works fine under KDE. I have read somewhere that set variables sometimes cause difficulties in Gnome etc… But there each computer is different from its configuration. I have linked to an Arch Wiki article. Normally this should work much better under Gnome, because Wayland is much more mature there than on KDE. But I have to say that I use a normal 1080p monitor.

The reason is: scree-scaling to 150%
The solution is: ==> about:config ==> widget.wayland.fractional_buffer_scale set to 1.0

That works.
Warning: do not set widget.wayland.fractional_buffer_scale less than 1.0 ==> FF menues freeze.
A value of 1.5 or more – FF menues freeze…

Wonderful, I’m glad you found out for yourself. :slightly_smiling_face:

1 Like

I’m not sure I agree with setting the env var globally.
Its kinda fine. But I’d prefer to put it in the desktop file.

You may or may not want to include the hw-accel bits too:

  1. Ensure that your video card is correctly configured for VA-API as described in Hardware video acceleration.

  2. Ensure WebRender is enabled by navigating to about:support and verifying the Compositing value is “WebRender”. It is enabled by default in GNOME and other desktop environments.

  • Ensure you are not running “Software WebRender” as that will not work as of August 2021.
  • If necessary, Hardware WebRender can be force enabled by setting gfx.webrender.all to true.
  1. Set media.ffmpeg.vaapi.enabled to true in about:config

  2. Run Firefox with MOZ_DRM_DEVICE environment variable set to your preferred rendering device. (Available devices can be listed with stat /dev/dri/*).

To achieve the last env vars copy the firefox.desktop file from /usr/share/applications to ~/.local/share/applications and edit each exec line (there are 3) like

Exec=/usr/bin/sh -c "MOZ_DRM_DEVICE=/dev/dri/card0 MOZ_ENABLE_WAYLAND=1 GTK_USE_PORTAL=1 /usr/lib/firefox/firefox %u"