Arch Linux / Docky / Linux · January 17, 2019 0

Two icons in dock?

Some time dock starts showing two icons of an app in dock, that is because dock failed to match the application window manager name (class) with the opened app.
For example MongoDB Compass showing dual/two icons on the docky.

To see what class name app is actually using we need to use xprop which is a package of xorg group.

Install xprop if you don’t have it already and run it.

$ sudo pacman -S xorg-xprop
$ xprop

Now click on the opened window for which you see two icons.
It ll start showing window information in the terminal.

Look for something similar to class name

WM_CLASS(STRING) = "mongodb compass community", "MongoDB Compass Community"

Now open the shortcut i.e I am going to edit MongoDB Compass shortcut.

sudo vi /usr/share/applications/mongodb-compass-community.desktop

Add following line after Exec section.

StartupWMClass=MongoDB Compass Community

Notice “MongoDB Compass Community”, we picked it from the WM_CLASS above as dock was expecting it to have “MongoDB Compass Community” but found “mongodb-compass-community”, so we add a class hinting.

Remove existing icon from dock by dragging icon out of dock and drop any where and add new icon by dragging the shortcut file from file manager to dock.

Click on icon and it ll start showing only one icon now.