2

My specs: Ubuntu 20.04.3 with Gnome Shell on Wayland. Notebook Acer Aspire 5 with AMD Ryzen 7 5700U.

For my work, I want to run Firefox through the sandboxing utility firejail. I created a custom *.desktop file to launch the "firejailed" firefox and placed it in ~/local/share/applications.

In the *.desktop file, I specified a custom icon (the blue Firefox icon that is used for the nightly builds) and the custom launcher uses this blue icon. Ok, fine.

When I run the launcher, the "firejailed" Firefox starts and runs correctly but the icon that is displayed in the window overview and in the task bar (or dock) is the standard Firefox icon (orange/yellow) not the blue one I specified.

What I have to do so that the running "firejailed" Firefox is displayed in Gnome Shell with the blue icon?

Here is how my *.desktop file looks like:

[Desktop Entry]
Version=1.1
Type=Application
Name=Firefox Work
Comment=Web Browser configurated for Work
Icon=firefox-nightly
Exec=firejail --private=/home/nuri/.firejail-firefox/ firefox -no-remote
Actions=
Categories=Network;
StartupNotify=true
nuri
  • 192
  • Check my answer for a similar problem. Note he first "xdg" line – kanehekili Jan 13 '22 at 22:20
  • Thanks for your answer but it makes no difference. I add the line "#!/usr/bin/env xdg-open" to the *.desktop file before "[Desktop Entry]". Then I started the firejailed-firefox from the shell and the normal orange icon is displayed :-( – nuri Jan 14 '22 at 09:05

3 Answers3

2

For those who want to have the practical solution, the working *.desktop file looks now like this:

Version=1.1
Type=Application
Name=Firefox Arbeit
Comment=Web Browser configurated for Work
Icon=firefox-nightly
Exec=firejail --private=/home/nuri/.firejail-firefox/ firefox -no-remote --class=fjfox
Actions=
Categories=Network;
StartupNotify=true
StartupWMClass=fjfox
nuri
  • 192
  • This doesn't work anymore in Ubuntu 22.04, the blue icon is again replaced by the normal Firefox icon when Firefox is running. Any idea? – nuri Nov 04 '22 at 10:36
1

Have this specific instance of firefox launch with a specific WMClass by adding the option

--class=CLASS

where CLASS is a name of your choosing, e.g. fjfox.

Then connect your custom .desktop laucher to that WMCLass by adding a line as

StartupWMClass=CLASS

See the answer of nuri for a full example of the desktop file.

vanadium
  • 88,010
  • Thanks vanadium, it works. – nuri Jan 14 '22 at 20:50
  • @vanadium does this method work for other programs as well, not only Firefox? – raj Jan 14 '22 at 22:24
  • 1
    @raj The option --class=CLASS will work with all GTK programs, and also Firefox and LibreOffice, which have a "GTK skin". – vanadium Jan 14 '22 at 22:40
  • ...and the same with VirtualBox, but without firejail? (in the Ubuntu dock, I want to see the icon of the app that is running in the virtual Windows 10, not the generic VirtualBox icon). Should I open a new question? – nuri Jan 15 '22 at 21:57
  • Do not hesitate to try it out yourself. – vanadium Jan 16 '22 at 11:06
1

In Ubuntu 22.04 running Wayland, you have to change the .desktop file as above. Use --name instead of --class= in the Exec line.

Version=1.1
Type=Application
Name=Firefox Arbeit
Comment=Web Browser configurated for Work
Icon=firefox-nightly
Exec=firejail --private=/home/nuri/.firejail-firefox/ firefox --no-remote --name fjfox
Categories=Network;
StartupNotify=true
StartupWMClass=fjfox
nuri
  • 192