Media Keys Don't Work

Reply

Media Keys Don't Work

12173268984
Casual Listener

Plan

Free

Country

 USA

Device

(Desktop PC)

Operating System

Debian with Unstable Updates

 

My Question or Issue

 The Media Keys Play/Pause/Next/Previous on the keyboard don't work with the Spotify Application.

 

The Media Keys work with other applications in Linux such as Clementine and also work with the Spotify Application in Windows just fine. I would think it should be easy to make the media keys work just like they do in Clementine and other media applications in Linux.

90 Replies

gumbeto
Music Fan

Snap updated spotify to 1.0.93.242.gc2341a27-15 here and the problem persists in that version.

ArtGravity
Composer

@gumbeto wrote:

Snap updated spotify to 1.0.93.242.gc2341a27-15 here and the problem persists in that version.


Confirmed as I had used 'snap revert' to get my media keys working again, and they were broken today. I had to run 'snap revert' to restore functionality.

 

Spotify, please get the devs to fix this regression before rolling out another snap and breaking the media keys again.

pachulo
Casual Listener

I'm also experiencing this problem with the snap in Ubuntu 16.04, but not with Ubuntu 18.04...

dchristofolli
Casual Listener

Actually the issue isn't attached by the Ubuntu version, but the desktop environment. The media keys does not works in Unity desktop (Ubuntu 16.04 default), but works in others desktops, like Gnome shell(Ubuntu 18.04 default). For example, if you install gnome session in Ubuntu 16.04, the keys will works perfectly

rjbruintjes
Regular

EDIT: Never mind, I spoke too soon! Issue persists.

 

ORIGINAL:

It seems the issue is finally fixed! My media keys are suddenly working again. 🙂

ArtGravity
Composer

I'm glad to hear that. Now I just have to remember to to deactivate the workaround on my affected laptop.

rjbruintjes
Regular

Actually, I don't know what happened but the issue still persists. Sorry for the false hope!

BlackDex
Regular

There is nothing Spotify can do, except maybe for modifying there player name to 0Spotify or something which maybe gets it sorted at the top of the dbus list.

 

When you encounter issues with your media-keys execute the following command and look at the result:

dbus-send --session --dest=org.freedesktop.DBus --type=method_call --print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames | grep 'org.mpris'

 

It will probably show that there is an other player also active, and possibly with a letter earlier in the alphabet then the S from Spotify.

 

To mitigate this at least for your self you could close this other player or use a tool i created which i posted a few posts back which you can use to bind it to Spotify it self.

 

6etacat
Casual Listener

Don't think media keys depend on name order. From my experience, it really only controls the app that started first. A quick fix is to start Spotify after you boot and leave it there. Media keys will always work for Spotify in this case. As you have mentioned, this isn't something the Spotify app can do to remediate. 

MadMartian
Music Fan

Excellent tip about looking-up the DBus mpris registry entries.  I usually have the opposite problem.  If I have both Spotify and Clementine running (I use Clementine for certain radio stations not available in Spotify) Spotify responds to the media buttons but not Clementine.  If I close Spotify then Clementine responds to the media buttons.

I was inspired to build on your DBus command, this will yield the process ID as well as the DBus name.  This will make it easier to pin-point the culprit using your process viewer.

DBus Media Player & PID

for qualifiedName in `dbus-send --session --dest=org.freedesktop.DBus --type=method_call --print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames | sed -n 's/.*"\(org\.mpris\..*\)"/\1/p'`
do
    printf "$qualifiedName\t"; dbus-send --session --print-reply --dest=org.freedesktop.DBus / org.freedesktop.DBus.GetConnectionUnixProcessID string:$qualifiedName | sed -n 's/^[[:space:]]*uint32 \([0-9]*\)$/\1/p'
done

Example

org.mpris.MediaPlayer2.clementine       24870
org.mpris.MediaPlayer2.spotify  19718
org.mpris.clementine    24870

I can then use System Activity to track-down these processes (screenshot attached).

spotify-clementime-processes.png

BlackDex
Regular
In your case i would suggest to try my mpris-control app then. https://github.com/BlackDex/mpris-control/ .
You can then create specific global hotkeys via your desktop tools, gnome, kde etc.. an handle that. I have super+<media-keys> linked to spotify and nothing else. And without super is just normal behavior.

6etacat
Casual Listener
Thanks. I'm just curious if it's actually the app timestamp that's governing the media key controls.

BlackDex
Regular
I think that maybe is desktop environment dependant. Kde or Gnome or xfce could handle it differently, but I'm not sure actually.

6etacat
Casual Listener
Have you tried closing spotify and opening it up again? What will your media buttons control now?

sakinyu
Casual Listener

Same problem here with version 1.0.94.262.g3d5c231c... Did anyone find a solution?

ArtGravity
Composer

@sakinyu wrote:

Same problem here with version 1.0.94.262.g3d5c231c... Did anyone find a solution?


Currently the only solution is to roll back to version 1.0.89.313.g34a58dea-5

navnav
Casual Listener

I have contacted Spotify support and can confirm that they are aware of the issue and this forum thread.

 

I'm hoping we have a fix for this soon!

navnav
Casual Listener

I spoke to Spotify support again today, just asking for an update on the fix for this.

They claimed to not know anything about the bug! Even though the last person I spoke to told me that their developers were aware of it and were working on a fix. After pointing this out, they resorted back to the 'Linux is not oficially supported' line.

 

I've been a premium member for years and I *only* use Linux. This issue is really frustrating and now I have no idea when/if it will be sorted.

 

I'll try contacting support again at a later date - maybe it was just this particular agent.

 

ArtGravity
Composer

@navnav wrote:

I've been a premium member for years and I *only* use Linux.

I, too, have been a paid subscriber for years and only use Linux (and Android, which technically runs on a Linux kernel, so I stand by my "only Linux" claim). When I first signed up, the only way to use Spotify on Linux was as a paid subscriber. For a brief period I did use the ad-supported version when it finally came to Linux, but it wasn't long before I switched back to premium.

 

Overall this is a minor issue for me since reverting the snap to 1.0.89.313.g34a58dea-5 restores functionality, but, assuming that the number in parentheses that follows the application version increments by one for every snap app release, I am now 10 releases behind current!

rjbruintjes
Regular

@ArtGravity wrote: 

Overall this is a minor issue for me since reverting the snap to 1.0.89.313.g34a58dea-5 restores functionality...


Perhaps off topic, but I cannot find a way to install a specific snap if I didn't have it installed before. (I'm installing Spotify on a new Ubuntu 16.04 machine.) Does anyone know how to do this?

dersu
Newbie

I use the following workaround while the issue is not fixed:

wget https://raw.githubusercontent.com/sveint/spotify-notify/master/spotify-notify.py
chmod +x spotify-notify.py
sed -i 's/com.spotify.qt/org.mpris.MediaPlayer2.spotify/' spotify-notify.py
./spotify-notify.py -n -s &
SUGGESTED POSTS