I have been using Rdio for about a year now.
While it has some holes with older music, all-in-all I am very happy
with the service.
Rdio uses a very capable web player so you can play your music in your
browser. That's perfect, however the one thing missing is support for
multimedia keys. After searching around for a Linux app that supported
multimedia keys, I discovered that I could roll my own very easily using
chrome, xbindkeys, and xdotool.
xbindkeys and xdotool
These two apps are the heart of what makes this work. xbindkeys grabs
the input keys, and executes xdotool which let's us operate on specific
windows and send key strokes to them. So they both need to be installed
first. I am using Fedora, but I presume these exist as packages in
whatever Linux you are using.
sudo yum -y install xbindkeys xdotool
The first thing is to create an "application shortcut" for chrome. Do
this by doing the following:
- Open Chrome
- Browse to http://rdio.com
- Click the tool icon thingy (three lines in the upper-right)
- Click Tools
- Click "Create Application Shortcuts"
- Choose where you want the shortcut to go. Really we are just
looking for it to create the .desktop entry so that it will show up
in Gnome's overlay mode so the default Desktop is all that's needed.
At this point there is a perfectly functional webpage acting like an
application. It should run if you hit the SUPER key and type rdio.
Below is my current config file. In order to get the keys to send, you
need to run
This will run xbindkeys in a window, make sure that window is active and
hit the key you want to bind. The code for that key will then show in
the console. Then you just write the config with the command that you
want to be run, followed by the key (that we grabbed before). This is
where xdotool comes in. We are going to search for a window named Rdio,
and send the keys that perform the multimedia functions. So for
example, when we hit the media key Play/Pause, it will send a space to
the window named Rdio.
#keystate_numlock = enable
#keystate_capslock = enable
#Media keys for my fake rdio app (chrome --app)
"$(grep '^Exec' rdio.desktop | tail -1 | sed 's/^Exec=//' | sed 's/%.//')"
Mod2 + XF86AudioMedia
"xdotool key --window $(xdotool search --name Rdio | head -1) space"
Mod2 + XF86AudioPlay
"xdotool key --window $(xdotool search --name Rdio | head -1) Left"
Mod2 + XF86AudioPrev
"xdotool key --window $(xdotool search --name Rdio | head -1) Right"
Mod2 + XF86AudioNext
By default, Gnome is going to have the keys bound to some multimedia key
default. And they are probably the same ones you are trying to bind.
So you have to disable the Gnome keybindings so xbindkeys can grab them
instead. To do this:
- Go to settings
- Either by clicking the icons in the upper-right hand side and
clicking the tools icon
- or...hit the SUPER key to go to overlay mode and search for
- Choose the keyboard under Hardware
- Click the Shortcuts tab
- Click "Sound and Media"
- Go to each key you want to grab from xbindkeys and when it prompts
you for "new accelerator" you can either hit Backspace to clear the
At this point you should have a fully functional web app that responds
to multimedia keys.