Skip to content

Instantly share code, notes, and snippets.

@ngauthier
Created July 5, 2012 20:10
Show Gist options
  • Star 30 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save ngauthier/3056149 to your computer and use it in GitHub Desktop.
Save ngauthier/3056149 to your computer and use it in GitHub Desktop.
Rdio "native" in linux

I like Rdio and linux. Rdio works great in a browser except for one thing: keyboard shortcuts!!!

When coding, I like to be able to play/pause my music quickly, meaning I don't want to switch windows. I figured out a way to do this:

Google Chrome --app

First, I made a file in my ~/bin called rdio that runs:

google-chrome --app=http://rdio.com

This opens Rdio in its own window, and most importantly, as its own application (kind of).

xdotool

Next, I made a file in my ~/bin called rdio-play-pause. This runs:

xdotool key --window $(xdotool search --name Rdio | head -1) space

This looks up a window with the name "Rdio" and sends the "space" key to it, which is Rdio's keyboard shortcut for play/pause.

Window Manager Keyboard Shortcut

Last, I am on XFCE, so I opened up the settings manager, went to keyboard -> Application Shortcuts. Then I created a shortcut to my rdio-play-pause script bound to XF86AudioPlay which is my keyboard's play/pause media key.

Thanks

Thanks to @IAmAru for suggesting I look into window manager command line tools.

#!/bin/sh
google-chrome --app=http://rdio.com
#!/bin/sh
xdotool key --window $(xdotool search --name Rdio | head -1) space
@jumph4x
Copy link

jumph4x commented Jun 27, 2013

Bookmarked.

@bryanlarsen
Copy link

rdio-play-pause didn't quite work for me. I'm using this: xdotool key --window $(xdotool search --classname rdio.com | head -1) space

@bryanlarsen
Copy link

This also works: xdotool search --classname rdio.com key space

@lucasff
Copy link

lucasff commented Feb 7, 2014

xdotool key --window $(xdotool search --classname rdio.com | head -1) space
works4me

@utopiabound
Copy link

I use FVWM so the key doesn't work unless the window is focused so I use:

FOCUS=$(xdotool getwindowfocus)
xdotool search --classname rdio.com windowfocus key space windowfocus $FOCUS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment