Play/pause music in Guayadeque through global keyboard shortcuts

I’ve tried a lot of music players on Linux, ranging from the desktop environment standards like Rhythmbox, Banshee and Amarok, to experimental ones like Tomahawk and Guayadeque. The latter has been my music player of choice for over a year now – its simple UI and small memory footprint works well for me.

One feature Guayadeque doesn’t seem to have is global keyboard shortcuts. Ctrl+Right/Left skips to the next/previous track, and Ctrl+Space plays/pauses the current track, but these shortcuts work only when the Guayadeque window has focus. Referring to this thread and this article, I went about writing a tiny shell script to play/pause music when Guayadeque is running, or launch Guayadeque and then perform the action. Here’s

dbus-send --type=method_call --dest=org.mpris.guayadeque /Player org.freedesktop.MediaPlayer.Pause
if [ $returnCode -ne 0 ];
  guayadeque &
  sleep 5
  dbus-send --type=method_call --dest=org.mpris.guayadeque /Player org.freedesktop.MediaPlayer.Pause

I replaced MediaPlayer.Pause in the above script with MediaPlayer.Next and MediaPlayer.Prev in separate scripts to handle skipping to the next or previous track. I mapped the shortcut Ctrl+F10 to launch, to use at times when I just want music to start playing!



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s