Google Music & Hype Machine keyboard controls on Mac OSX

Update 9th March 2016: Fixed the workflows to work with new changes to both Google Play Music and Hype Machine

Music, music everywhere…

For some time now I have been using Google Music and Hypem as my main source of music. These services are great – Hypem always has a great selection of fresh music and a great user experience. Google Music is useful because of it’s companion app on my Android phone.

The only problem with these great services? Having to switch back to my browser and to the correct tab when ever I want to play, pause or skip to next or previous tracks. Frankly it’s a pain in the arse – particularly when you consider the music controls staring back at me from the top of my Mac’s keyboard.

The solution

Naturally I did some poking around on Google and found an interesting solution – use applescripts, registered as global services, accessed by key combinations.


  1. Download the Zip archive containing the workflows and extract it.
    • The code is available on GitHub if you want to contribute 🙂
  2. Move all three extracted workflows to ~/Library/Services/ (/Users/{you}/Library/Services/)
  3. Open System Preferences and open the Keyboard section.
  4. On the left-hand side, select ‘Services’.
  5. On the right hand side, scroll down to the ‘General’ section and you will find the three new services. Here you can enable them and select an appropriate key combination for each as per the screenshot below:
  6. Fire up Chrome, load up the Hype Machine or Google Music and give it a whirl.

Using Function Keys

The more hawk-eyed reader will notice that in the screenshot above I have mapped the three services to the playback control keys on a Mac keyboard. In fact, I haven’t – I have mapped them to the corresponding Fn keys.

OSX does not let you override actions assigned to the playback keys themselves. This means that if I wanted to use the Play/Pause service mapped to ⌘F8 I must press fn + F8.

Clearly reaching for the fn key is going to get tiresome very quickly. Luckily you can use a neat little tool called FunctionFlip to make the three playback keys default to their Fn value instead of their standard playback action so that you don’t have to press fn. Neat!


FunctionFlip stopped working on OSX Yosemite, but I got it working again. See here: FunctionFlip on OSX Yosemite

Update 26th July 2016: I can’t seem to get FunctionFlip to install on OSX El Capitan, but have found that Karabiner can do the same thing (and more). There are loads of intimidating settings – don’t panic though, you only need to enable the one shown in the image below:



  1. The scripts are written only to work with the Chrome browser. They could however be adapted to work with other browsers so by all means do so if you feel so inclined.
  2. If you have both Hypem and Google Music open in the same window, the one in the right-most tab will be controlled.
  3. Opening Hypem in one window and Google Music in another will not cause anything to explode, but you will have no way to predict which one will be controlled.


If you have any issues with these scripts please let me know in the comments below and I will try and help. If you would like to contribute any improvements, again leave a comment below and I will get back to you 🙂


This solution was originally implemented by nathanator11 over at Mac OSX Hints. I have simply picked up where he left off.

Also credit goes to k10g for his original work on this.

Thanks guys!

21 Comments on “Google Music & Hype Machine keyboard controls on Mac OSX”

  1. Works great with KeyRemap4MacBook and Panel View for Play Music! I bound the controls to F7, F8 and F9 and set “Music Controls to F7,F8,F9” on at KeyRemap. Just perfect. Thanks a lot!

  2. This only works for me if Automator has window focus. Oddly, if I am in any other app, including chrome,nothing happens, but if I “play” the service from automator, or even use the newly-defined keyboard shortcuts, it goes over to chrome and makes it work. Weird.

  3. Hi,

    Next/previous song stopped working a while ago. It is easy to fix this by tweaking the scripts, though. You will need to hit the buttons directly like this (previous song) – (document.getElementsByClassName(‘flat-button’)[1]).click(); . Use index 2 for play/stop (old solution seems to work still) and index 3 for next song.

    I found this solution initially at . You can find SJBPost codes there in case you want to do something else (like hotkeys for thumbs up/down).

  4. I just installed this, but nothing seems to happen when I press the keys using Google Music. The chrome tab flashes, but none of the three actions happen.

    Any ideas?

  5. Hey Charlie thanks for the work on this. I’ve set everything up but when I use a command it opens iTunes (which was not running) and then executes the command. Restarting Chrome and my computer hasn’t helped. Any ideas?

    I’m running Chrome 33.0.1750.29 beta and Mac OS X 10.8.5 (12F45).


  6. Thanks for the hack! This is awesome. For some reason I cant get the Play/Pause button to work though. Im on Mavericks 10.9.2.

    • Yeah, same here. Play/Pause broke a few days ago. I guess Google must have changed their end somehow given the old JS code doesn’t work anymore. Curiously prev/next work still.

      @Charles, Maybe Play/Pause can be triggered some other way? It would be very easy to do `trigger` with jQuery (maybe even without). This would bypass Google API.

Leave a Reply to Chris Cancel reply

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

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

Connecting to %s

%d bloggers like this: