According to Mabishu:
After a lot of requests from Linux users, Spotify developers have integrated D-Bus support in version 0.4.8.282. So, what this means is simply and awesome! Now Linux developers could use this programmatic interface to interact with Spotify from other apps.
In other words, now is quite simple to send «play», «pause», «move next/previous song» events to Spotify and with this get Spotify fully integrate into our desktop.
To toggle playing and pausing from the terminal, run:
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
To hook it to the Pause/Break keyboard key:
- Select System -> Preferences -> Keyboard Shoertcuts
- Click Add
- Enter any Name: Play or pause Spotify
- Paste in the Command: dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
- Click Apply
- Click Disabled on the right so it changes to New Shortcut...
- Press the Pause/Break key
- Click Close
- Listen to music in Spotify and press the Pause/Break key to pause or play the music.
See the Mabishu post to see how to check the other commands you can hook up to other keys.
(Tested with Ubuntu 10.10 and Spotify for Linux preview 0.6.291)
Thanks very much!
Posted by: Carlos | July 05, 2012 at 05:52 PM
Merci!
Posted by: T | August 15, 2013 at 06:52 PM
This is so cool. I have been looking for an option like this on ubuntu, thank a bunch!! :)
Posted by: Ahamed Kashif | April 28, 2014 at 07:42 AM
*thanks a bunch :)
Posted by: Ahamed Kashif | April 28, 2014 at 07:42 AM
This doesn't work anymore with Ubunut 16.04 and Spotify 1.0.49.125.g72ee7853-111
Posted by: My name is | March 08, 2017 at 12:20 AM
Sorry, I was wrong, this does work :D
Posted by: My name is | March 08, 2017 at 05:33 PM