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 guayadeque_playpause.sh

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

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 guayadeque_playpause.sh, to use at times when I just want music to start playing!

Downloads:
guayadeque_playpause.sh
guayadeque_prev.sh
guayadeque_next.sh

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s