Using Firefox/Wayland on Mir servers

Firefox will work “out of the box” on Mir servers that are configured to support X11 applications. But Firefox has support for Wayland and it would be good to enable this.

There are a couple of things that need doing for Firefox to use Wayland on Mir servers:

  1. It needs MOZ_ENABLE_WAYLAND set in the Firefox environment.
  2. Secondly, it needs gfx.webrender.all set to true in the user options of the current profile.

While the latter can be set in the Firefox GUI I found it convenient to write a script that patches all profiles:

$ cat `which fix-firefox-wayland.sh`
#!/bin/sh

if [ -f prefs.js ]; then
  echo Checking profile \'$(pwd)\'

  if [ ! -f user.js ] || ! grep -q "gfx.webrender.all" user.js; then
    echo Fixing user.js for profile \'$(pwd)\'
    echo 'user_pref("gfx.webrender.all", true);' >> user.js
  fi
else
  find ~/.mozilla/firefox/ -name prefs.js -execdir $0 \;
fi

I hope you find this useful.

1 Like