Active application icon not shown on dock
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.
I am using Gnome as my desktop environment on Ubuntu 20.04. Why does this happen and how to fix this?
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.
- Copy the
.desktop
file of that application from/usr/share/applications/
folder to your local directory~/.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 wasStartupWMClass=kcolorchooser
. - Save the file and enjoy! The problem will be gone.