Skip to main content

Separating Work and Life in Firefox

Separating browsers for work and personal life is a no-brainer. Some even go down a path of separate OSes. I am not so radical, but I want some degree of isolation. A good place to start is to create separate profiles and make using them as simple and seamless as it can be.

Unfortunately, profile management and on-startup profile-picking menu are atrocious in Firefox. I just cannot stomach the idea of unironically using it. I know me, and I am lazy - if it is not one click / one shortcut away, if I have to think about it and make myself do it, I won’t. That’s why for a long time I used Firefox for personal life and Chromium for work. You don’t have to do anything to achieve isolation.

Of course there is a wonderful mechanism of containers, but that won’t cut it. It’s too easy to mix something up.

So, I did a thing - just created a copy and modified ~/.local/share/application/firefox.desktop. The format is self-explanatory - we have names, submenus, actions associated with the desktop entry itself and submenus, commands to execute… And everything is translated into 50 other languages. A bit of a nuisance, but I can endure a bit of jjjjj.

So, firefox accepts the -p key with which you can specify the profile to launch, after knowing that everything is quite straightforward. Just modify all execs to firefox -p work... and the names of entries to Firefox Work and you are done.

Almost.

The first problem is an icon - again, without changing the icon it is too easy to mess something up. So, I switched the icon to Icon=firefox-developer-edition. Since I am not on dev edition, of course.

The next problem arises a bit later. Gnome associates Firefox Work with the default Firefox desktop entry - that means, that you cannot reasonably use dock to switch between the two. After a few months of putting up with mediocrity, I decided to spend about 5 minutes to solve this issue. It took 1 minute. The first question to be answered was “How does Gnome group windows? What parameter does it use?”. The only option in the .desktop file I did not understand was “StartupWMClass” and I immediately got a hunch that this is what I was looking for. After this and this StackExchange questions the puzzle is complete:

...
Exec=firefox --class firefox-work -p work %u
StartupWMClass=firefox-work
...