Debian – GNOME confuses names of multiple different Firefox installations

debiandesktopfirefoxgnomeicons

I use GNOME on Debian Jessie and I have different Firefox installations:

  • the ESR version bundled with GNOME, which I cannot remove (as it is a dependency)
  • the stable version installed from the special Debian repo
  • the binary files from Mozilla (installed in /opt/firefox/...) downloaded from their website as explained here
  • the developer edition (also as binary files) from Mozilla (installed in /opt/firefox-dev-edition)

In /usr/share/applications there are therefore different .desktop files.

$ ls -la firefox*
-rw-r--r-- 1 root root 3640 Okt  4 21:29 firefox-bin.desktop
-rw-r--r-- 1 root root 3,6K Okt  2 08:06 firefox.desktop
-rw-r--r-- 1 root root 2,2K Aug 31 22:57 firefox-dev.desktop
-rw-r--r-- 1 root root 3,8K Sep 22 08:29 firefox-esr.desktop

So all files have basically this layout:

[Desktop Entry]
Encoding=UTF-8
Name=Firefox
Name[bg]=Firefox
Name[ca]=Firefox
[...some more languages...]
Comment=Browse the World Wide Web
Comment[bg]=Сърфиране в Мрежата
Comment[ca]=Navegueu per el web
[...some more languages...]
X-GNOME-FullName=Firefox Web Browser
X-GNOME-FullName[bg]=Интернет браузър (Firefox)
X-GNOME-FullName[ca]=Navegador web Firefox
[...some more languages...]
Exec=<somePath> %u
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=<someIcon>
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;[...]
StartupWMClass=<someStartupClass>
StartupNotify=true

So the ESR version has the Name=Firefox ESR and of course also X-GNOME-FullName=Firefox ESR Web Browser. The things that matter are these:

Exec=firefox-esr %u
Icon=firefox-esr
StartupWMClass=Firefox

I used this file (and the icon files provided by Mozilla) to create a desktop file for the developer edition, which looks like this:

Exec=/opt/firefox-dev-edition/firefox %u
Icon=firefoxdev
StartupWMClass=FirefoxDev

The firefox.desktop is created by the installation from mozilla.debian.net and is this:

Exec=/usr/lib/firefox/firefox %u
Icon=firefox
StartupWMClass=Firefox

To create a shortcut for the binary version of Firefox I copied firefox.desktop and named it firefox-bin.desktop. I changed the NAME= and X-GNOME-FullName= of the original firefox.desktop to distinguish it from the binary version and changed firefox-bin.desktop to this one:

Exec=/opt/firefox/firefox %u
Icon=firefox
StartupWMClass=FirefoxBin

Also in /usr/bin there are different binaries:

$ ls -la firefox*
-rwxr-xr-x 1 root root 113 Sep 22 08:29 firefox
lrwxrwxrwx 1 root root  30 Sep 22 08:40 firefox-esr -> ../lib/firefox-esr/firefox-esr
lrwxrwxrwx 1 root root  22 Okt  2 08:17 firefox.real -> ../lib/firefox/firefox

So the issue is that GNOME still confuses these Firefox installations. All version are sometimes labelled as "Firefox ESR" in the top panel when I am running them.
So when I click on "Firefox" to open it for a short time in the top panel "Firefox" is shown, but a few seconds later it changes to "Firefox ESR" although I can confirm that the executed Firefox installation is not the ESR version.

Firefox starts as "Firefox", name later changes to "Firefox ESR"

This happens with Firefox, "Firefox Debian" and Firefox Developer Edition.
Sometimes even Tor Browser gets the label "Firefox ESR", which indicates that GNOME possibly just uses the executable name (firefox in this case) to determinate what program is running…

So how can I fix this?

Edit: For testing I created a symbolic link from /opt/firefox/firefox ->
/opt/firefox/firefoxbin.real
and used that "new" file in the desktop file, but this changed nothing, so the executable name does not seem to matter.

Edit2: Additionally I now changed the StartupWMClass of firefox-esr.desktop from Firefox (which was duplicate in firefox.desktop) to FirefoxESR. Afterwards now GNOME always shows me "Firefox Debian" (the name saved in firefox.desktop) even for all other Firefox versions, even for the ESR one. Changing the StartupWMClass for firefox.desktop did not help.

Best Answer

Well, I might as well answer to your question.

Try using the --class flag in firefox. If it matches the relative .desktop file, the various instances should be grouped correctly. For example, in your .desktop file:

Exec=firefox --class FirefoxDevel %u

It works for me for the same firefox executable, so as long as your versions support that flag, you should be good to go.

Related Question