1

So under my volume drop down menu, I have Spotify, Rhythmbox and VLC:

enter image description here

Here I can pause and play the various different applications. My question is, is there a command to pause the one that is currently playing, e.g. I could set up a short cut to pause whichever was playing. This is mainly because Spotify doesn't have command options as far as I can tell, and I would like to pause it using blue proximity when I get up?

Tim
  • 32,274
  • 27
  • 118
  • 177
  • The lack of a universal command to pause/play the currently playing media player annoyed me enough that I wrote a python script to do just that. I put it on Github. Here is the link: https://github.com/mel00010/OmniPause – Mel McCalla Oct 25 '17 at 23:36

1 Answers1

2

If you need command-line access, you can talk to it directly over DBUS. Here's an example I stole from Fran Diéguez:

To pause:

dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Pause

Or to toggle:

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

For more commands, see the MPRIS2 Player specifications.

Taken from Oli's answer to this question.

Tim
  • 32,274
  • 27
  • 118
  • 177