Firefox profiles on Wayland
I have been using multiple Firefox profiles for years now. You define a custom .desktop
file in ~/.local/share/applications/
with appropriate --profile
value and then you can pin this custom application to dock and use it as
regular program when you search for it. This way you can have multiple "identities" for the same websites without having to log out or use Containers (which didn't exist before, and I still find them somehow clunky).
By default, Firefox will not associate that custom .desktop
with running program, so you would end up with an icon that does launch the profile you wanted, but with generic Firefox icon instead of your custom one.
On X11, you had to set the WM_CLASS
attribute by passing in --class
flag and specifying StartupWMClass
(and using same value for both).
However, that stopped working in Wayland, because Wayland does not use WM_CLASS
. I tried to search for solution multiple times, but with no luck. I ended up going back to X11 for some time and then I used Cinnamon
(also running X11) that "just kept working".
Recently I decided to go back to GNOME, for multiple semi-complicated reasons. I have forgotten about this use-case I have, and it hit me after I migrated everything. But surprise surprise -- while it took a while (over an hour, I
believe), I did find a solution. --name
.
You have to pass in undocumented --name
parameter instead, and it works. Hurray.
So, to have a custom profile with custom icon, define your file as follows:
[Desktop Entry]
Version=1.0
Name=Firefox (Banking)
Exec=firefox --new-window -P Banking --class=firefox-banking --name=firefox-banking %u
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=.../.mozilla/firefox/Profiles/banking.jpg
StartupNotify=false
StartupWMClass=firefox-banking
Categories=Network;
Many thanks to Reddit's user Apoema who shared this!