1

In 20.04, I had this working fine using .desktop files like this:

[Desktop Entry]
Version=1.0
Name=Firefox Web Browser (Personal)
Comment=Browse the World Wide Web
GenericName=Web Browser
Keywords=Internet;WWW;Browser;Web;Explorer
Exec=firefox -P Personal --class FirefoxPersonal --no-remote %u
StartupWMClass=FirefoxPersonal
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=firefox
Categories=GNOME;GTK;Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall;
StartupNotify=true
Actions=new-window;new-private-window;

[Desktop Action new-window] Name=Open a New Window Exec=firefox -new-window -P Personal --class FirefoxPersonal

[Desktop Action new-private-window] Name=Open a New Private Window Exec=firefox -private-window -P Personal --class FirefoxPersonal

I have several other profiles for different purposes. They all use the --class argument to Firefox to add the special WM_CLASS property, and then the .desktop file tells Gnome (presumably) to look for StartupWMClass=.... This worked fine in 20.04.

Now in 22.04, notably with Firefox snap, it does correctly launch with the right profile, and the WM_CLASS property is set to the correct value, but the dock shows a new icon below the dividing line, and if I launch multiple Firefox instances for each profile, they are all grouped under that icon.

If I add that icon to favorites, it loses all information about profiles (it asks at startup) and still groups all the windows together.

I'm wondering if this has to do with the fact that Firefox is running as a snap. Has anyone had this issue and have they found a workaround? All that I can find here and elsewhere is stuff that applies to earlier versions of Ubuntu.

siride
  • 1,093
  • 1
  • 9
  • 13
  • 2
    Yes- it is one of the many snap drawbacks and how to get rid of them – kanehekili Aug 13 '22 at 18:34
  • Could (and I think more likely) also be related to Wayland. How does the window class appear in the "looking glass" (Alt+F2, lg , Windows tab). – vanadium Aug 14 '22 at 14:05
  • @vanadium It also happens when using Xorg. – siride Aug 14 '22 at 18:20
  • @kanehekili This fixed the issue. I don't like the fix because I know snaps are going to be the future. Maybe future versions will address that problem. – siride Aug 15 '22 at 16:17
  • Snap is -in my opinion- a linux killer since it uses a MS Windows approach: Install everything a 100 times. But Linus Torwalds pointed out clearly: You can't write software for Linux due to the fragmentation of the distros. This can't be the future. Distros Reunite! – kanehekili Aug 15 '22 at 23:14
  • @kanehekili It's not really the same as Windows except for bundling, and you have to be joking if you think the distros weren't already fragmented before in terms of packaging. If anything, this creates an opportunity for unity. They just need to iron out the kinks, which I believe can and will be done. – siride Aug 16 '22 at 02:21

1 Answers1

1

The workaround was to move from Snap to regular Firefox install. I suspect the issue is that when launched via Snap, the initial WM_CLASS value is something generic (possibly not even Firefox) and then eventually gets changed once the startup gets further along. But GNOME isn't smart enough to deal with this, so it groups the window in the wrong place.

Following the steps in this link worked for me: https://askubuntu.com/a/1403392/906933

siride
  • 1,093
  • 1
  • 9
  • 13