running program icons do not match panel and menu icons

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
lperg
Level 1
Level 1
Posts: 15
Joined: Fri Mar 27, 2020 1:00 am

running program icons do not match panel and menu icons

Post by lperg »

Linux Mint 20.3
Cinnamon 5.2.7
5.4.0-117-generic x86_64

I run several programs simultaneously with different preferences/profiles (routinely 3 Firefox, 2 Pale Moon, 2 Brave, 2 Geany, 2 Terminals), each launched from its own customized launcher in the menu or on one or the other of my two panels. Each of these launcher instances have their own icons so I don't have to hunt for them on the panels. Unfortunately, once a program is running and its icon appears on the window list applet (that's the right name for it, isn't it? I'm not sure) it is not the customized icon but the generic one. For instance instead of the customized red icon I assigned to "Firefox Email" I get the default orange one, etc. What causes that behavior, and can it be fixed? How does the system even know what the icon "should be" in the first place?

Thanks,

-lp-
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: running program icons do not match panel and menu icons

Post by smurphos »

The Window manager matches up the WMCLASS assigned to the window to the filename of a valid desktop file available in the menu (i.e. the desktop file has to be in /usr/share/applications or ~/.local/share/applications) and uses the icon defined in that desktop file for the window list.

Starting an application with a specific WMCLASS can sometimes be done with the --class argument in the startup command in the desktop file(most GTK apps), but sometmes the WMClass is hard-coded in the app. You can get clever with the command wmctrl to get around this.

Example - a launcher for gnome-terminal that will run htop and will display in the window list with a system-monitor icon. The important thing is the the file is called htop.desktop, and the WMCLASS is also htop

~/.local/share/applications/htop.desktop
Content

Code: Select all

[Desktop Entry]
Name=htop
Exec=gnome-terminal --class=htop -e htop
Comment=
Terminal=false
Icon=gnome-system-monitor
Type=Application
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
lperg
Level 1
Level 1
Posts: 15
Joined: Fri Mar 27, 2020 1:00 am

Re: running program icons do not match panel and menu icons

Post by lperg »

Thanks. It will take me a while to digest this, experiment a bit, and get back to you. It does seem rather complex for something that is, after all, a GUI intended to make the system more intuitive and user-friendly.

-lp-
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: running program icons do not match panel and menu icons

Post by smurphos »

No worries - I should have mentioned that I think (can't be sure as don't use it) Mint's Web Apps program will sort this out for browsers and any Chromium based browser has this feature natively in any case (create standalone web-apps, with own launcher and icon from a web page), it's just a bit buried in the browser settings - so you should only need to do it for things like Geany and your terminal based apps.

Hint - right click on desktop and create launchers there (accepting offer to add them to your menu which will create the desktop file in the right place) to set up, then add your shortcuts to the panel from the menu. If you've already got custom menu items, then it should be just a case of possibly renaming the associated desktop files (menu-editor gives them stupid names) in ~/.local/share applications and adding the --class argument to the exec command.

Why it is like this? - Because it's a standard across the vast majority of Linux desktop environments to make it easier for application developers to make sure their apps work across all desktop environments - https://www.freedesktop.org/wiki/Specif ... tion-spec/

If you get stuck with something specific just shout back.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
vanadium
Level 4
Level 4
Posts: 324
Joined: Sun Dec 27, 2015 1:07 pm

Re: running program icons do not match panel and menu icons

Post by vanadium »

Do not also forget to add a "StartupWMClass" entry to your desktop file. This is how the operating system knows which running window belongs to which icon.
Locked

Return to “Cinnamon”