How to remap the play/pause key to Grooveshark

keybindingskeyboard

I like to listen to Grooveshark while coding on my mbp. Since it's a website, every time I want to pause or continue I need to find the tab in my browser and click with the trackpad.

Is there a way to remap the F8/Play-Pause key to provide this functionality?

Hitting this key currently brings up iTunes, which I never use.

I'm open to any scripting and/or coding solutions, if it comes to that.

Best Answer

It is possible for Desktop apps to take control of the play/pause key. Spotify, the Last.FM desktop scrobbler, and a few other apps I've used have all allowed the play/pause media key to work with their app in Mountain Lion. However, browsers will probably never allow websites to register key handling on a global level, because this is an incredibly large security risk. Imagine if a site registered a global handler for all your standard keyboard keys.

I don't believe this is possible. Maybe some combination of browser scripting will allow you to use hotkey software like KeyRemap4Macbook to run an Applescript that finds a tab on the domain grooveshark.com with the status playing, and sends a javascript command into the page to pause it.

But if GrooveShark is 100% flash based, (and IIRC it is,) you're completely out of luck.

GrooveShark needs an app. A native, first-party OS X app that can actually take advantage of modern desktop APIs. Until then, I don't believe this is possible.