Linux Spotify Media Keys for Ubuntu, ArchLinux and more!

Spotify is an amazing music service with awesome Linux support … except they never included proper media key support.

Here's how to make Spotify Linux respond to both Gnome Media Keys and custom media key settings from anywhere!

The first option, if you use Gnome or have integration with Gnome media key support is the easiest and best way to go about things.

John Reese created a very handy script to wrap around Spotify and give us global Gnome media key integration. You can grab it here:

The installation is rather simple, though I thought it was a little teebit confusing (though they are very straight forward and simple). I've provided two options for you:

  1. Follow the step by step process yourself (command line work required).
  2. Use my script to download and install it for you.

The step by step process:

  1. Visit the github page and download the code ( … You can do this by clicking on the “ZIP” button near the top left.
  2. Extract the zip file.
  3. Open up a terminal and navigate to the extracted code.
  4. Find out where Spotify is installed:
    1. Use the command >”whereis spotify”.
    2. With luck, it'll say “/usr/bin/spotify”.
    3. If not, then refer to John's instructions to editing his code or ask me for help here in the comments.
  5. As root, copy the file from inside the extracted folder ‘bin' into the folder ‘/usr/local/bin/'.
    1. You can do this with:  >”sudo cp bin/spotify /usr/local/bin/”.\
    2. Remeber to put the tailing ‘/' at the end!
    3. OR use John's version with: >”sudo install bin/spotify /usr/local/bin/”.
    4. Both will accomplish the task just fine. Pick one, not both!
  6. Exist spotify if you have it open. Then open it like you normally do by clicking on the spotify icon or via the commandline command >”spotify”.

It'll automatically wrap around Spotify and let you use media keys!

Using my script to download and install the Spotify Media Key Wrapper:

  1. Download my script: From Dropbox ( or from github (
  2. Extract it.
  3. Run it with the command:
    1. > ./install_spotify_media_keys

My script will download and install everything for you and then clean-up after itself. 🙂

Using the non-media-key script way:

There is another way to use media keys with Spotify. It's by using Dbus commands pretty much directly.

What you're going to have to do it set your media keys to specific DBUS commands that do very specific Spotify commands. This works because Spotify has support for it, they just didn't implement it. You can use these in your .xbindkeysrc file or just set them through your system keyboard shortcuts applet. Either way works. Or even map them to a command-line alias or app; your choice. There is no wrong answer here.

Here is the code in a nutshell (originally from jylam):


Now let me explain the code:

dbus-send is the command to use dbus. –dest= is the application API you are using while /org/mpris is pretty much the protocol stuff and the thing like “org.mpris.MediaPlayer2.Player.PlayPause” is that actual command you are sending. “PlayPause” is well … the play and pause button in one. The rest is pretty obvious.

If you're mapping that to just a command, leave out the XF86AudioPlay part. That's for the .xbindkeysrc file stuff.

If you really want a customized and advanced experience: try this link:

It details every possible command for Spotify via DBUS and the command line. It even tells you how you can play specific songs and music from a url! Cool stuff there.

If this has worked for you, let me know. If you have another solution, give a shout and let the world know!