Bitcoin donations are welcome:14snQXeLcnJtWUduKZ6rC2MHdPYrYar1Tw

Wednesday, June 29, 2011

Mediakeys for spotify in Linux

There is two ways of doing this.

1.) Native Spotify player for Linux (requires Unlimited or Premium)
Create spotify-control containing this (credits go to this allenap):

#!/usr/bin/env python

import dbus
import sys

if __name__ == '__main__':
    session = dbus.SessionBus.get_session()
    spotify = session.get_object(
    for command in sys.argv[1:]:
        getattr(spotify, command)()

chmod 755 spotify-control

Next, put the file into i.e. /usr/bin/
Now you got a cmd way of controling your spotify player.. spotify-control Previous, spotify-control Next and spotify-control PlayPause...

If you are using fluxbox as I am, add the following to your ~/.fluxbox/keys

# Spotify
Mod4 Right :Exec $(spotify-control Next)
Mod4 Left :Exec $(spotify-control Previous)
Mod4 space :Exec $(spotify-control PlayPause)

Save, "reconfigure" (or restart fluxbox), and you are done..
Now you can use your windows button + Right/Left for Next/Previous or Space to pause :)

2.) If you are using spotify via wine..
This way is a bit more "unslick" and nasty.. But it works..
You do it the same way, except you use the following script located here..


  1. sry, what does: 'Create spotify-control containing this' mean? Do I make a file called I'm a total n00b at python..or linux in general..

  2. Sebatian: Just create a file called "spotify-control", which should contain the text above...

    Then su, to get superuser privileges, and chmod 755 spotify-control, to make it runable by anyone...