Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Media Keys Don't Work

Media Keys Don't Work

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.

Reply
90 Replies


@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!

Does d-bus still work?

dbus-send --print-reply=literal --session --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause

If so, someone mentioned earlier they made a temporary work-around with a Python script that maps the media keys to the appropriate dbus messages.


@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?


@MadMartian wrote:

Does d-bus still work?

dbus-send --print-reply=literal --session --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause

If so, someone mentioned earlier they made a temporary work-around with a Python script that maps the media keys to the appropriate dbus messages.


Yes! d-bus still works in my computer (16.04). I just created new keyboard shortcuts  with the dbus commands and assigned to them the media keys. It works! And I am only using media keys with spotify so it works for me.

I confirm the proposed dbus command works! With that, I was able to workaround the issue by adding keybindings to the commands below.

 

Note that either `--type=method_call` or `--print-reply` is needed, otherwise the type is "signal" and it does not work (see man dbus-send). I wonder if the original problem is related to that.

 

 

dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous
dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next

 

 

The keybindings can be set in the Keyboard settings window, under Shortcuts->Custom Shortcuts:

 

Media keys workaround for spotify (v > 1.0.89)Media keys workaround for spotify (v > 1.0.89)

After that, click on the key-combination column and press the desired media key on the keyboard. Entering each shortcut will disable existing shortcuts with the same key (namely under "Sound and Media")

Worked for me. The only drawback is that you loose the media buttons for everything else.

I'm considering using other programmable buttons to do this.

Good point. You could add a different keybinding for spotify only, but that is not ideal either.

I just pressed the play/pause key on my Logitech K750 that had been encountering this issues, and it worked, so I checked my Spotify snap app version to confirm that it was still on the last known working release. Much to my surprise, it had been upgraded to 1.0.98.78.gb45d2a6b-10.

 

This version is working for me!

 

Edit: not working on same version on the following day - see follow up post.

Not working here, and I have the same version. Did you change anything else relevant in your system?


@gumbeto wrote:

Not working here, and I have the same version. Did you change anything else relevant in your system?


I did not make any software changes outside of normal package updates from system repositories, which should not be relevant.

 

After reading a previous comment about altering keyboard shortcut assignments, it is worth mentioning that I did examine my system setting for Keyboard/Shorcuts/Sound and Media. I selected Play (or play/pause) and pressed the play/pause key on my keyboard. It did not alter the value displayed, but on the off chance that it had an effect, it seemed worth mentioning.

My previous celebration apparently was premature.

I don't know why the keys worked yesterday, but they no longer work again today.

 

I guess I'm going to have to run a snap revert.


@gumbeto wrote:

I confirm the proposed dbus command works! With that, I was able to workaround the issue by adding keybindings to the commands below.

 

Note that either `--type=method_call` or `--print-reply` is needed, otherwise the type is "signal" and it does not work (see man dbus-send). I wonder if the original problem is related to that.

 

 

dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous
dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next

 

 

The keybindings can be set in the Keyboard settings window, under Shortcuts->Custom Shortcuts:

 

Media keys workaround for spotify (v > 1.0.89)Media keys workaround for spotify (v > 1.0.89)

After that, click on the key-combination column and press the desired media key on the keyboard. Entering each shortcut will disable existing shortcuts with the same key (namely under "Sound and Media")



Worked for me.
I only use the media keys with Spotify so this solution is perfect.
Tanks a lot!

The workaround of @gumbeto works nicely, but i wanted to make it a bit more easy to type so i created a small application which does the same. You can replace the long dbus-send commands with a shorter line.

You can use

mpris-control toggle
mpris-control next
mpris-control previous

As the commands.

Just place the mpris-control application somewhere it can be execute, like your ~/bin folder or something.

 

You can get it from here: https://github.com/BlackDex/mpris-control/releases

Media keys still have no effect with latest apt version.

Spotify Linux version:

1.0.98.78.gb45d2a6b

On Ubuntu 16:04

This was originally reported over 4 months ago! Is there any progress on this issue?

Thank you for taking the time to post.  I almost decided to upgrade
that package today.


@gumbeto wrote:

I confirm the proposed dbus command works! With that, I was able to workaround the issue by adding keybindings to the commands below.

 

Note that either `--type=method_call` or `--print-reply` is needed, otherwise the type is "signal" and it does not work (see man dbus-send). I wonder if the original problem is related to that.

 

 

dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous
dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next

 

 

The keybindings can be set in the Keyboard settings window, under Shortcuts->Custom Shortcuts:

 

Media keys workaround for spotify (v > 1.0.89)Media keys workaround for spotify (v > 1.0.89)

After that, click on the key-combination column and press the desired media key on the keyboard. Entering each shortcut will disable existing shortcuts with the same key (namely under "Sound and Media")


 

Spotify build: 1.1.0.237.g378f6f25

In case this sollution does not work and you are like me using Ubuntu 18.04 with Unity, then you need to apply this:

https://askubuntu.com/a/1082188

to fix a bit broken Keyboard > Custom Shortcut functionality beforehand. 

Steps that I've done:

1. Applied the sollution from askubuntu.com website.
2. Created a Custom Shortcuts as gumbeto suggested.
3. Rebooted.

Result:

Play/Plause media key on my Logitech K270 controls Spotify again.

This software worked for me

https://github.com/milgra/macmediakeyforwarder

http://milgra.com/mac-media-key-forwarder.html

 

Forwards media keys to iTunes or Spotify directly.

You can prioritize which app you would like to control or you can go with the default behaviour which controls the running app. The app runs in the menu bar.

Installation

Check installation steps here

Issues you should know about

The app listens on the event tap for key events. This causes problems in some rare cases, like

  • when changing search engine in Safari's preferences window

  • when trying to allow third-party kernel extensions

In these cases simply pause Mac Media Key Forwarder from it's menu.

I'm not sure the Mac media keys forwarding is relevant for this thread but the media keys still don't work.

It would be less of an issue if they'd never worked but this is an obvious regression that shouldn't have happened surely. It's pretty dissapointing but hopefully for the 6-month-versary of the issue which is coming up we'll get a fix — fingers crossed for 2019-04-14.

 

 

I found a workaround that works for me consistantly on Ubuntu 18.04

 

Fix Spotify media player buttons using the dbus-send command as a new keyboard shorcut:
(this downside is that it overrides all other media players for the assigned buttons)
  • Play/Pause: 
    dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
  • Stop: 
    dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop
  • Next: 
    dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next
  • Previous: 
    dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous
Or install use the "mpris-control" instead of dbus located at:
wget -O ~/Downloads/mpris-control https://github.com/BlackDex/mpris-control/releases/download/0.1.0/mpris-control
sudo chmod +x ~/Downloads/mpris-control 
sudo mv ~/Downloads/mpris-control /usr/local/bin/
 

I'm really disappointed there is still no fix for this regression. I would even be happy to switch back to the older snap that works for some users in this thread, but I can apparently not get that one anymore.

 

I understand there is no official support for Linux, but if you do publish a version, then make it work. If you're not going to fix a regression that's been there for six months, that is going to frustrate a lot of paying customers, including me.

Suggested posts