10

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)

Mateo
  • 8,104
Gordo
  • 101
  • 1
  • 4
  • 2
    To me, this looks like a bug in Spotify and should be reported as a bug to them. I think they expect the user to keep Spotify running and use the indicator to show/hide it, rather than exit and later restart from the Launcher. Note the 2 different arrows next to the 2 icons, one indicating the launcher icon, the other showing a running instance. The failure of these 2 icons to merge is not, I think, something you can change with settings. – chaskes Nov 10 '13 at 01:50
  • 1
    Seems linked to how soon I start it up on my computer, wait a minute then launch - or quit then relaunch, must be a bug in how it launches all it's services - or it not waiting for something it needs be launched properly. – Mateo Nov 10 '13 at 02:13
  • This happens or has happened with a variety of software: it is a consequence of the way Unity (and specifically a library called bamf) works. – Alistair Buxton Nov 11 '13 at 08:21
  • @AlistairBuxton so this is a bug in bamf or Spotify? – Salem Nov 15 '13 at 21:46
  • 1
    It's a bug in bamf. See for example: https://bugs.launchpad.net/unity-2d/+bug/704046. bamf is the "bamf application matching framework" - it's job is to detect whether two windows belong to the same application and thus should be stacked under the same launcher icon or not. There is no reliable way to do this for all applications, so bamf exists specifically to handle corner cases like java and spotify. – Alistair Buxton Nov 16 '13 at 09:11

3 Answers3

11

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/

Mateo
  • 8,104
  • Unfortunately, this solution does not function on Ubuntu 14.04. If you have a different workaround please post it. – Luís de Sousa Aug 21 '14 at 17:31
  • nope, it is the same situation, "even with the desktop file below results seem inconsistent and buggy." try diffrent combitnations of closing the window/quiting in the indicator, then locking/unlocking the launcher, as well as editing the launcher in /usr/share/applications – Mateo Aug 21 '14 at 21:30
2

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.

Raja G
  • 102,391
  • 106
  • 255
  • 328
1

You can avoid the bug if you first click Hide Spotify (in the system tray icon) before exiting Spotify completely.

fabiomaia
  • 387