Duplicate (Spotify) Icon in launcher

I have installed spotify on Ubuntu 13.04 and have locked the icon on the launcher. But when I exit the program fully or even restart and use that icon to open spotify, a new icon is created or a different icon is generated with a ? on it.

It is a clean install of Ubuntu 13.04 so was wondering if this is a known bug or if there was a way of making sure it just doesn't created a duplicate icon?

N.B it has not happened as of yet to any other program I have installed (Chrome & Steam)


It is a bug, this is a partial workaround.

To workaround quit out using the launcher (or just closing the window) and relaunch leaving the indicator in the top menu running) even with the desktop file below results seem inconsistent and buggy.


Create a new launcher that has StartupWMClass=Spotify defined.

You can make a spotify.desktop file with these contents:

[Desktop Entry]
Name=Spotify
GenericName=Music Player
Comment=Listen to music using Spotify
Icon=spotify-client
Exec=spotify %U
TryExec=spotify
Terminal=false
Type=Application
Categories=Qt;Audio;Music;Player;AudioVideo
MimeType=x-scheme-handler/spotify
StartupWMClass=Spotify

Or edit the orginal from /opt/spotify/spotify-client/spotify.desktop (requires superuser permissions) adding the line StartupWMClass=Spotify at the end

Save it somewhere you can keep it like "Documents". Then drag it to the launcher.

This will make sure that the windows with the WMClass named spotify will open under that icon.

Code to get WMClass of a window:

xprop|grep WM_CLASS

This returns the following when clicking on the spotify window:

WM_CLASS(STRING) = "spotify", "Spotify"

(This seems to only partially solve the issue, completely exiting will probably end up with two icons again)

Note: I noticed that the problem started happening less and less the more I launched it - this is probally due to my system having preload installed, it might help: https://apps.ubuntu.com/cat/applications/preload/


Then remove the Icon in the launcher which you have previously locked to launcher and mark the icon which came after to launcher.

I am not saying that do this everytime. I am thinking that the launcher accessing the same Icon everytime from somewhere else.so remove the locked one and keep the new one. Then have restart and try again.