How to Create Global Shortcut Keys for Rhythmbox Music Player in Any Desktop

Brendan Kidwell brendan@glump.net

10 April 2008

I use Rhythmbox as my primary music player in Ubuntu Linux, but a few months ago I switched from GNOME desktop to KDE. Since Rhythmbox is a GNOME-style program I couldn't find an easy way to setup global hotkeys in the KDE desktop that send commands like Pause and Play to the running instance of Rhythmbox. The command-line tool “rhythmbox-client” provides a solution:

Create a launcher anywhere in your desktop's menu system that runs the command you want, for example

rhythmbox-client --play-pause

And then assign a global shortcut key to that launcher, for example Ctrl+Alt+\.

Here is a list of all the commands rhythmbox-client supports:

  --no-start                 Don't start a new instance of Rhythmbox
  --quit                     Quit Rhythmbox
  --no-present               Don't present an existing Rhythmbox window
  --hide                     Hide the Rhythmbox window
  --next                     Jump to next song
  --previous                 Jump to previous song
  --notify                   Show notification of the playing song
  --play                     Resume playback if currently paused
  --pause                    Pause playback if currently playing
  --play-pause               Toggle play/pause mode
  --play-uri=URI to play     Play a specified URI, importing it if necessary
  --enqueue                  Add specified tracks to the play queue
  --clear-queue              Empty the play queue before adding new tracks
  --print-playing            Print the title and artist of the playing song
  --print-playing-format     Print formatted details of the song
  --set-volume               Set the playback volume
  --volume-up                Increase the playback volume
  --volume-down              Decrease the playback volume
  --print-volume             Print the current playback volume
  --mute                     Mute playback
  --unmute                   Unmute playback

Note that the launcher you create will probably NOT open a terminal by default, so any output that might result from your Rhythmbox command (from the –print-playing command, for example) will probably be lost.