Custom app icon in taskbar

I want to have two shortcuts to launch firefox.

  1. Launch with user profile “bob”
  2. Launch with user profile “smith”

I can create to custom bob.desktop and smith.desktop files on my Desktop and customise them with the require command for launching firefox directly into specific profiles. So far so good. I customise each shortcut with a different icon. The custom icons show on the desktop (they are different).

When I launch these shortcuts, they appear in the KDE taskbar but they have the original/defauly Firefox icon and I cannot easily tell them apart. I have been googling and trying things without success. Any ideas?

I would suggest you make copies into /home/$USER/.local/share/applications/ pointing to the real firefox with profile changes.

Thanks for the suggestion. I had considered that but it feels very hacky and given how often web browsers are updated these days it sounds high maintenance. I guess I could script something to handle it every day or something. I’m surprised you cannot do this in a cleaner way :frowning:

Hi @james8aus,

I suspect it’s done with the Icon key in the .desktop file.
According to this page:

As of July 2018, there seem to be some bugs in Unity in how it reads .desktop files. Specifically, the path provided for the Icon field cannot be wrapped in quotes. Even if the path contains spaces, it must not be wrapped in quotes.

On the other hand, it’s worth mentioning here that the path provided for the Exec field must be wrapped in quotes if it contains spaces. If it doesn’t contain spaces, the quotes can be left off. This inconsistency in behavior is horribly confusing and should really be considered a bug.

Thus, the following is a valid .desktop:

[Desktop Entry]
Name=Firefox Developer Edition
Comment=The developer edition of Firefox Quantum.
Exec="/home/jack/Applications/Firefox Developer Edition/firefox"
Icon=/home/jack/Applications/Firefox Developer Edition/browser/chrome/icons/default/default32.png
Terminal=false
Type=Application

The following will run, but not display the icon:

[Desktop Entry]
Name=Firefox Developer Edition
Comment=The developer edition of Firefox Quantum.
Exec="/home/jack/Applications/Firefox Developer Edition/firefox"
Icon="/home/jack/Applications/Firefox Developer Edition/browser/chrome/icons/default/default32.png"
Terminal=false
Type=Application

And the following won’t even run:

[Desktop Entry]
Name=Firefox Developer Edition
Comment=The developer edition of Firefox Quantum.
Exec=/home/jack/Applications/Firefox Developer Edition/firefox
Icon=/home/jack/Applications/Firefox Developer Edition/browser/chrome/icons/default/default32.png
Terminal=false
Type=Application

So, it seems you might only need a Icon= key for every file.

Hope this helps.

Thanks @Mirdarthos.

I checked and found the following on my system:

  1. The Exec field must not be in quotes
  2. The Icon field must not be in quotes
  3. Changing the Icon field does change the icon displayed for the .desktop file (Firefox - ProfileX.desktop in my use case) but when using it (launching firefox from this .desktop file) the application icon shown in the KDE taskbar continues to be the standard Firefox icon and not the custom one configured in the .desktop file.

@Fabby No I haven’t had time to set it up yet and I am still considering how best to maintain it. I want it automated…even if the RIO is crap :slight_smile: Will share when I do!

What if you place your custom icons in ~/.local/share/icons/ and set the icon filename in the .desktop file?

Example: for the file ~/.local/share/icons/firefoxbob.png write Icon=firefoxbob in the desktop file.

Yeah, I tried using the inbuilt icons which is effectively the same thing and it had the same result.

Hi @james8aus,

Apologies, I didn’t realize you also wanted that. How silly of me.

For that you’ll need to specify the --class= parameter in the Exec= line of the .desktop file.

That value specified must then be linked with the .desktop file. This is done by adding the StartupWMClass key, with the same value as specified in the --class= parameter above in the [Desktop Entry] section of the .desktop file.

@Mirdarthos would you mind sharing an example?

Not at all! However, I can’t find one I did at the moment, so I’m going to giver one that I’m unsure will work.

$ cat /usr/share/applications/VSCodium.desktop
[Desktop Entry]
Name=VSCodium
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=/usr/share/vscodium-bin/bin/codium --no-sandbox --unity-launch %F --class=VSCodium
Icon=vscodium
Type=Application
StartupNotify=true
StartupWMClass=VSCodium
Categories=Utility;Development;IDE;
MimeType=text/plain;inode/directory;
Actions=new-empty-window;
Keywords=vscode;
StartupWMClass=VSCodium

Well, that’s how I’ve got it and I hope it helps, or at least leads you in the right direction.

On a side note, I successfully changed Firefox icon by using “Edit Aplication” menu when right clicking on the Firefox menu entry… So not sure what it changed as the .desktop file in /usr/share/applications/ was not touched.

It probably created a copy in /home/$USER/.local/share/applications/ automatically, I would guess.

I didn’t have the multiple .desktop files, I only had one (the original one from Firefox installation), and the icon this way did not change when running Firefox. Maybe when you run multiple then it breaks somewhere.

1 Like

Hey @Fabby , I started to do this but something occurred to me. Even if I copy the firefox binary, I still need a way modify the icon shown for that binary in the taskbar, given that the icon you specify in the .desktop file has no affect on what is displayed on the taskbar. Make sense or am I missing something?