Score:0

Ubuntu 21.04 custom firefox.desktop creates new icon rather than run indicator by custom icon

vn flag

We share a desktop so I have a Firefox application launcher for each of us to load our individual profiles; here's mine:

[Desktop Entry]
Version=1.0
Name=s3rvant-Firefox
Comment=Browse the World Wide Web
GenericName=Web Browser
Keywords=Internet;WWW;Browser;Web;Explorer
Exec=firefox %u -P s3rvant --class s3rvantfox
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=/home/s3rvant/Launchers/Firefox/Firefox-s3rvant.png
Categories=GNOME;GTK;Network;WebBrowser;
MimeType=
StartupNotify=true
Actions=NewWindow;NewPrivateWindow;ProfileManager;

[Desktop Action NewWindow]
Name=Open a New Window
Exec=firefox -P s3rvant --class s3rvantfox -new-window

[Desktop Action NewPrivateWindow]
Name=Open a New Private Window
Exec=firefox -P s3rvant --class s3rvantfox -private-window

[Desktop Action ProfileManager]
Name=Open the Profile Manager
Exec=firefox -ProfileManager --class s3rvantfox

In Ubuntu 20.04 this has worked fine keeping the various profile window indicators grouped on their respective launcher icons as expected. However since upgrading to 21.04 when I click one of these launchers the default Firefox icon is added to the dock for the newly opened window with running indicator by that icon. Clicking on a 2nd profile opens another window with indicator also by that default icon even though the 2nd window is using the 2nd profile.

I've tried adding the following to top block but no change:

StartupWMClass=s3rvantfox

I've also tried moving the launchers from ~/.local/share/applications to /usr/share/applications but again no change.

Any idea how to fix?

us flag
I don't have an answer, but I have some potentially useful information. 20.04 defaulted to an Xorg session. 21.04 defaults to a Wayland session. StartupWMClass is ignored in Wayland sessions, because it relies on an X11-specific WM_CLASS window property that doesn't exist in Wayland.
s3rvant avatar
vn flag
Thank you Marius; that does appear to be the issue at least. Using Looking Glass to inspect the window does indeed list it as Wayland and wm_class remains "firefox" which as I understand Wayland uses "app-id" for this purpose though I've not yet found a way to set the app-id in desktop launcher.
Prof.Chaos avatar
us flag
This question seems very, very closely related to the one described here: https://askubuntu.com/questions/1360144/new-instances-of-kile-get-a-new-defaul-icon-rather-than-new-red-bullets-in-ubu
Prof.Chaos avatar
us flag
This issue is sadly still not solved, also not in the related post linked above. However, I'd like to add that Wayland can't be the (core) reason since I deactivated it and still have the same behavior.
Score:0
us flag

I believe that I have the solution, though it might require some back-and-forth until it actually works. Anyway I had a very similar problem (I had such a link in the favorites, which opened a new icon), and it did at the end work for me!

Key is the solution provided in the Stackoverflow entry on duplicate icons in the navigation.

I'm not sure whether I need to/should copy the solution from there into here (should I? comments on that?), so I'll just refer to it (solution by pomsky) and gave an abstract repetition of that solution plus additional comments.

  • Indeed the launcher must be copied into ~/.local/share/applications
  • There you will indeed have to add the line StartupWMClass=VALUE -- however it MIGHT be that the value that you set there is not the entirely correct one. You will fond out while value that is by running that program (i.e., open you link), run xprop WM_CLASS in a terminal, and then click on the program. It will then display the correct value.
  • If that doesn't work, try adding it to the favorites (after you copied the edited file into the above-mentioned folder).
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.