Fixing Dual Icons in Docky

Docky is a great little taskbar for Linux, and it does a decent job of replicating the OSX bar.

It does however have a few problems in identifying an application when it’s running, because it’s expecting the xwindows WM_CLASS value to match the name of the executable in the Exec entry of the *.desktop file…

There is a pretty simple way of fixing this, and an ideal candidate to explain is Google Chrome.

To start with, we need to start the offending application.  go ahead and open Google Chrome, and you get two icons in Docky.  One is the launcher icon, and the other is the running instance.

Next, open a terminal and run the command xprop

At this point your pointer becomes a cross, and you need to click the application in question.  xprop will then return the xwindow properties of the window you clicked.  for Google Chrome you should see something like:

WM_CLASS(STRING) = "Google-chrome-stable", "Google-chrome-stable"

The important piece of information in those results is:

WM_CLASS(STRING) = "Google-chrome-stable", "Google-chrome-stable"

Notice the capital ‘G’ in Google there?

next, go to the location of the *.desktop file for that application, which is likely to be:

$ /usr/share/applications

and open the *.desktop file:

sudo gedit google-chrome.desktop

in the file are three sections: [Desktop Entry], [NewWindow Shortcut Group] and [NewIncognito Shortcut Group].  You’ll notice that each of these sections has a line looking something like:


Notice the lower-case ‘g’ in Google?

This is where Docky gets all confused, because it launches google-chrome-stable, but the window is called Google-chrome-stable!

All Docky needs is a little hint that is needs to launch the application, but look out for a window with a slightly different name.  To do this, in each section add:


Save the file, close Google Chrome and open it again, and hey-presto, the launcher icon gets the highlight of an open window!!!