2

I have got some applications such as KColorChooser, KBreakOut, MadView3D which are not showing any application icon on the dock when they are active. Only a square with no icon is shown. Also, When I hover over them, instead of the application name, unknown is shown.
enter image description here

I am using Gnome as my desktop environment on Ubuntu 20.04. Why does this happen and how to fix this?

3

I have solved the problem with the help of this video: https://youtu.be/xZ_M3Q-U-J0.

Here is the summary:
Gnome (and any other Desktop) identify instances of an application and keeps track of them with the WM_CLASS property.
Some of the KDE applications do not provide a WM_CLASS property within them and due to this missing WM_CLASS property, Gnome cannot keep track of the applications and therefore cannot associate the icons with them. Every time a new instance of that same app is created, it shows a new element on the dock.
This problem also occurs in KDE plasma: https://forum.kde.org/viewtopic.php?f=289&t=160452

Solution:

  • Open the application which behaves this way.
  • Open up a terminal and issue the command xprop WM_CLASS. The mouse cursor will change to a + symbol. Click on that application with the + shaped cursor. The WM_CLASS string will be printed out on the terminal.
    enter image description here
  • Copy the .desktop file of that application from /usr/share/applications/ folder to the ~/local/share/applications/ folder. For me, it was named org.kde.kcolorchooser.desktop.
    Do not modify the original file, because it will get replaced whenever the application is updated.
  • Open the file in a text editor and add the line StartupWMClass=<WM_CLASS> where <WM_CLASS> should be replaced by the string you got from the above command. For me, it was StartupWMClass=kcolorchooser.
  • Save the file and enjoy! The problem will be gone.
0

General aspects

Icons on the dock and in the application overview correspond with desktop launcher files. These are small text files with the .desktop extension. They provide information to the operating system on how to launch the application, what icon to use...

If an application has no corresponding .desktop file, or some of the elements in the .desktop file are not properly defined, the system may revert to a generic icon and a generic application name.

You can locate all .desktop files containing for example KColorChooser with the command

find / -name '*.desktop' -exec grep -H $1 "KColorChooser" \; 2>/dev/null

Specifics for KDE snap applications

I can not fully reproduce the issue you indicate: for two of the three applications you mention, I get two icons, one with correct icon and one with generic icon. When launching, the correct icon is used in the dock, and the correct application name is shown.

For some KDE packages that come as a SNAP, there may be packaging issues. When installed for the first time, two different .desktop files are installed under /var/lib/snapd/desktop/applications/:

kcolorchooser_kcolorchooser.desktop
kcolorchooser_org.kde.kcolorchooser.desktop

They have different names and a different Exec= line, hence they appear as two different icons. kcolorchooser_kcolorchooser.desktop specifies the full path of an icon under /snap/kcolorchooser/, and is the one showing the icon. kcolorchooser_kcolorchooser.desktop specifies kcolorchooser, but that apparently is not within the normal search path for icons, and a generic icon is shown.

A workaround is to hide the "bad" .desktop file. Copy it to your ~/.local/share/applications directory and add a line Hidden=true.

10
  • Two of the applications seem to be "KDE". KDE apps seems to be hit-n-miss with the dock. I wonder if OP is using snaps. Some KDE snaps come with two icons, one of which looks stupid. – DK Bose Jun 17 '20 at 12:42
  • @vanadium, can I manually associate an icon by editing the .desktop file? If so, which portion of the file should I edit? – Puspam Jun 17 '20 at 13:55
  • @DKBose I threw some light on the issue with the KDE snap apps, but still I cannot reproduce the issue of the OP, who does not have any icon (even not the generic one) and where the launcher does not show the name of the application. – vanadium Jun 17 '20 at 15:09
  • @Puspam Yes, you can. Best is to make a local copy of the .desktop file. You specify the icon on the Icon= line. – vanadium Jun 17 '20 at 15:10
  • Here is the desktop file of kcolorchooser app pastebin.com/2d8Lwrt3. Can you please have a look at it? – Puspam Jun 22 '20 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.