The Missing Bit

Using Firefox on Wayland with X11 apps

I use sway on wayland, and one annoyance I had, is this error:

firefox error

It took me quite a while to pinpoint when it was occuring, because it was not very frequent and I did not really put any energy in finding what was causing it.

I then realized, when using Chatty a Java based chat client, that every link I clicked in Chatty would trigger this error. This was good in a sense, because it gave me a way to reproduce the issue.

I changed Chatty openUrl command to a shell script, from which I could analyse environment and fire Firefox with overriden environment variables.

Then, I realized that Chatty was an X11 app, and was launching firefox with GDK_BACKEND=x11. This was preventing Firefox from communicating with the running instance.

After some researchs, I found this environment variable: MOZ_DBUS_REMOTE, this environment variable force firefox to use D-Bus.

Just set this variable, and then Firefox will use D-Bus even when launched from an X11 app.