Mixed X11/Wayland environment is a source of great annoyance when comes to running Firefox on Wayland along other X11 applications, like terminal, mail clients etc. Some X11 applications set
GDK_BACKEND variable to x11 which effectively breaks Wayland applications and causes Firefox to start in X11 mode. That breaks Firefox remote protocol when Firefox searches for running instances and tries to reuse it.
When Firefox instance is already running on Wayland and you launch X11 version you get infamous “Firefox is already running” dialog due to locked Firefox profile.
Firefox 74 ships new MOZ_DBUS_REMOTE env variable and it forces Firefox on X11 to use D-Bus remote protocol as well as Wayland version does. So when X11 Firefox is launched after Wayland one with the same profile, already running Wayland instance is reused to open the link instead of the “Close Firefox” greetings.
All you need is to put this line to your ~/.bashrc file and restart your shell:
export MOZ_DBUS_REMOTE = 1
7 thoughts on “Wayland/X11: How to run Firefox in mixed environment”
Why isn’t MOZ_DBUS_REMOTE the default? Have bugs been filed against those applications that set GDK_BACKEND *and* can be used to spawn other apps?
MOZ_DBUS_REMOTE is default on Fedora but other distros need to decide. AFAIK not all distros / evironment have D-Bus running by default.
AFAIK it was reported but I can’t find the bug now.
Thanks. I had this very same problem after upgrading to gnome40. Setting MOZ_DBUS_REMOTE=1 fixed my issue.
I run fish as my default shell. I tried export MOZ_DBUS_REMOTE=1 in my both my bashrc and fish.config.
Putting MOZ_DBUS_REMOTE=1 and MOZ_ENALBE_WAYLAND=1 in /etc/environment ultimately worked for me.
Are these env variable still needed?
Are they needed when running Wayland without X11 applications (example Sway without the Xwayland layer)?
Nightly is running on Wayland by default when Wayland is present. As for Release without X11 I *guess* we use Wayland in such case but I’m not sure.