Fix for Firefox's slow start on Arch Linux with i3WM Window Manager
2 min read
Recently I switched from Debian Stable to Arch Linux. I had many audio problems with Debian Bullseye and decided to try Arch Linux once again. Everything went well and my machine is compatible with everything. However, I confronted a problem where Firefox took too long to start, at least 12 to 15 seconds each time I executed it.
Once Firefox executed, the program opened all other windows instantly as expected, however, this slow start meant delays when writing an email, or researching a topic when I first started the machine.
This week I found a link on the Mozilla forums in which an user points out that executing the following command when loading your i3wm configuration file fixed the problem for him, and it did solved the problem for me too. Too solve this problem you should place this code along all programs you launch when loading i3. This code works with Systemd and gnome-portal which is a requirement for Firefox on Arch Linux. The man page of dbus-update-activation-environment explains what this code does. This code is also available on that man page.
"dbus-update-activation-environment is primarily designed to be used in Linux distributions' X11 session startup scripts, in conjunction with the "user bus" design. To propagate DISPLAY and XAUTHORITY to dbus-daemon and, if present, systemd, and propagate DBUS_SESSION_BUS_ADDRESS to systemd."
exec dbus-update-activation-environment --systemd DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY &
Now Firefox starts promptly as expected.