Control Spotify with a Griffin PowerMate

Update: Please see this post, where I extend the below idea a bit further and provide AppleScripts that enable your PowerMate to control iTunes or Spotify, depending on which app is currently playing, or was last paused.

First off, if you don’t already use a PowerMate, then, well, you’re really missing out. Just trust me on this one.

Three years ago I described how I use a PowerMate for system-wide control of iTunes, namely next-track, play/pause and system volume. Quite a bit has changed since then. At the time that post was published I was using Sizzling Keys to interpret the key sequences I was having the PowerMate send. A few months later I stopped using Sizzling Keys when I realized I could accomplish the same thing with FastScripts (and some AppleScript), and earlier this year I did away with FastScripts and set everything up in Keyboard Maestro.

Another major change is that I now get the majority of my music via Spotify, despite its starring issue. One thing I was adamant about maintaining through the iTunes-to-Spotify transition was the ability to control all things music via the PowerMate. Fortunately, getting this working ended up being much easier than I thought it would, mainly because of the latest PowerMate software.

I can’t remember exactly why I upgraded the PowerMate software1, but I did, and apparently this version, 3.x, came out almost a year ago. (Who knew?!) The big addition for me was that you now could use AppleScript directly, instead of having to route key commands to, for example, FastScripts, which ultimately would execute your script. (Another great new feature is that you now can use modifier keys to define new triggers based on the base PowerMate controls. I do this for a 30-second skip, described below.)

This powerful addition to the PowerMate software, coupled with the fact that Spotify too is AppleScript’able, meant that shifting these controls from iTunes to Spotify would be a breeze, and that everything could be accomplished without using third-party software (which, if you’ve been following along, would have been Keyboard Maestro).

What’s more, after digging around Spotify’s AppleScript dictionary, it quickly became apparent that controlling it would be exactly like controlling iTunes, which was not only super simple, but something I’d worked out years ago.

Armed with the above information, all I needed to do was create three global triggers and associate with each of them an AppleScript that accomplished the intended action. (Note that system volume up/down are the default global actions for the rotate left/right triggers, so there was nothing to do there.)

Press action (to play/pause):

tell application Spotify to playpause

Long Press action (to advance to the next track):

tell application Spotify to next track

CMD+Press action (to skip forward 30 seconds in the current track; I previously discussed this trick):

tell application Spotify to set player position to (player position + 30)

That’s it! I now have complete PowerMate control over Spotify, no matter the application that is front-most on my desktop.


Note that if you have trouble with your PowerMate after upgrading the software (from 2.x to 3.x), be sure to remove PowerMate.prefPane from /Library/PreferencePanes/. I was losing my mind trying to figure out why my stuff wasn’t working, and it was only dumb luck that I remembered the software used to be implemented via a prefPane.