Custom icons in the task manager

(Using Plasma 6.0 on KDE Neon)

When adding an application launcher icon to a panel, I can change the icon displayed for that application by right-clicking it, opening Properties, and then clicking on the icon to select a new one. I use that feature to have multiple options to launch Firefox with different profiles (it’s faster than opening a generic Firefox instance and then switching profile every time). However, when I do launch the application, the icon that gets displayed in the task manager is the regular Firefox icon, and not the custom icon that I configured.

Is it possible to display custom icons in the task manager when an application is launched from a .desktop file that has a different Icon value set?

3 Likes

I’m having the same issue, and it’s an eyesore. Did you ever figure this out?

Figured it out!

I had to go to

/var/lib/flatpak/app/org.mozilla.firefox/current/active/export/share/applications/org.mozilla.firefox.desktop

and change the icon for it. To do that, I had to take ownership of the file and its directory because of permissions. After changing the icon, I restarted the machine, and the new icon was displayed on the task manager whenever I was using Firefox. Oddly, even though I have FF in the quick launch panel, when I run FF, it shows up as a second icon on the task manager, so my panel shows two FF icons, but I’m okay with that.

Just realized that the icon will revert to the default whenever the app is updated via regular Discover updates. Changing it might get a bit old. Maybe they’ll make this easier with a future KDE Plasma upgrade.

to move things from /user/share... to ~/.local/share... you can use the kpackagetool5 --install command and the system should make use of your copy rather than the system copy.

keep in mind tho, that updates to the system copy will not be reflected in your local copy unless you run this again.

so while it might help reduce the frequency of your having to change it each time, you will still have to do maintenance of it on your own.

1 Like

Thank you! However, I’m too noob to know how to do that without specific instructions. If you’re willing to provide those, I would try them out, though I understand if that is too complex or you rather not.

i did this successfully for the digital clock .qml but i don’t know that it would work for a flatpak file

all i know is that when the .qml was located in my ~/.local/share... directory it took priority over the official one in /usr/share... and i could make edits to my copy that persisted.

this was the command i used.

kpackagetool5 --install /usr/share/plasma/plasmoids/org.kde.plasma.digitalclock/

and it basically copied all the files and folders below that point into

~/.local/share/plasma/plasmoids/org.kde.plasma.digitalclock/

where i could make changes to the .qml file.

so i would try

kpackagetool5 --install /var/lib/flatpak/app/org.mozilla.firefox/current/active/export/share/applications/

and see what you end up with in your ~/.local/share directory.

then see if making changes to that desktop file are picked up by firefox when you launch it… might need to relog or reboot first.

otherwise i’m in way over my head too.

I use the amazing Candy Icons from the Sweet KDE Theme and installed Firefox, Thunderbird, and Spotify with snap. Via a cron job and with autostart, I have a script called icon_fixer.sh (run by sudo) that specifies the Task Manager panel icons every hour (cron) and at log in (autostart). In my home directory, I made a folder called icons with the icons I want to use.

#!/bin/bash

perl -pi -e 's/Icon\=.*/Icon=\/home\/tcb\/icons\/thunderbird.png/' /var/lib/snapd/desktop/applications/thunderbird_thunderbird.desktop

perl -pi -e 's/Icon\=.*/Icon=\/home\/tcb\/icons\/firefox.png/' /var/lib/snapd/desktop/applications/firefox_firefox.desktop

perl -pi -e 's/Icon\=.*/Icon=\/home\/tcb\/icons\/spotify.png/' /var/lib/snapd/desktop/applications/spotify_spotify.desktop

You’ll need to make sure you alter your visudo to allow sudo execution without a password, adding something like:

tcb ALL = (root) NOPASSWD: /home/tcb/Documents/icon_fixer.sh

my crontab entry, which runs 5 minutes past each hour, looks like:

05 *   *  *   *     sudo /home/tcb/Documents/icon_fixer.sh

my ~/.config/autostart desktop file looks like:

[Desktop Entry]
Exec=sudo /home/tcb/Documents/icon_fixer.sh
Icon=dialog-scripts
Name=icon_fixer.sh
Type=Application
X-KDE-AutostartScript=true

Icons with SVG extensions blank on the Task Manager panel when loading, but all you need to do is change the SVG extension to PNG.

I also use Mozilla VPN, which is installed with the mozillavpn repo, and added the following two lines to the script:

perl -pi -e 's/Icon\=.*/Icon=\/home\/tcb\/icons\/vpn.png/' /usr/share/applications/org.mozilla.vpn.desktop

perl -pi -e 's/Exec\=.*/Exec=\/usr\/bin\/mozillavpn ui/' /usr/share/applications/org.mozilla.vpn.desktop

image

This is one of those examples why the search magnifying glass on this website needs to be muuuuuuch bigger. This issue has been discussed countless times before. Like here for example: https://discuss.kde.org/t/confusing-task-manager-icons/20116/8

For what it’s worth, my go-to solution for customizing task manager icons is using Window Rules in KWin to match the window in its “in use” state, and then force a desktop file name to match a desktop file set to the icon I want.

At least for how I use my device, that has the advantage of working regardless of how that window comes to be - restored Firefox session, launched from app launcher, or any other way.

As an example, my Todoist desktop entry, named todoist.desktop:

[Desktop Entry]
Version=1.0
Terminal=false
Type=Application
Name=Todoist
GenericName=To-Do List Manager
Exec=firefox --new-window "https://app.todoist.com"
Icon=todoist
Categories=Office;

And the KWin window rule that corresponds:

[Firefox Todoist]
Description=Firefox Todoist
desktopfile=todoist
desktopfilerule=2
title=Todoist — Mozilla Firefox
titlematch=2
types=1
wmclass=org.mozilla.firefox
wmclasscomplete=true