Media Keys In OSX For Any Keyboard

I recently bought a shiny new mechanical keyboard to use with my Mac. So far, I’m liking it, but I miss having media keys for controlling volume and music playback like on my Apple & Logitech keyboards.

To address this, I wrote a few simple Applescript services that you can bind keyboard shortcuts to, which enable media commands (volume up/down, mute, play/pause, and next/prev track) for any keyboard.

You can download them by clicking here. Once downloaded and unzipped, simply double click each workflow file to install it. Note that these are only tested in OSX 10.7 Lion.

To bind keyboard shortcuts to the scripts, go to System Preferences > Keyboard > Keyboard Shortcuts. Select Services in the left panel, then scroll down to the script you want to assign a shortcut to. Double click on the right side of the row to edit the shortcut. Now, just hit the key combination you want to use, and make sure the checkbox to the left is checked (it likes to uncheck when you edit the key combo).

I used the following shortcuts:
Command +:
F13 – Volume Down
F14 – Mute
F15 – Volume Up

Command + Option +:
F13 – iTunes Volume Down
F14 – iTunes Mute
F15 – iTunes Volume Up

Command + Control +:
F13 – iTunes Previous Track
F14 – iTunes Toggle Pause
F15 – iTunes Next Track

I chose these because they are conveniently grouped at the top right of my keyboard, and I don’t use them for anything else. Note that you seem to need to include a Command in your key combo for it to work everywhere.

Also note that I made the system volume control fairly granular (5% increments), and the iTunes control fairly coarse (20% increments) based on my personal preference. You can easily edit these values by opening the workflow files in Automator. The scripts can be found at ~/Library/Services/ once installed.

Grant Skinner

The "g" in gskinner. Also the "skinner".

@gskinner

12 Comments

  1. Download seems to be broken

  2. Fixed.

  3. Totally unrelated, but just wanted to say that I stumbled across your blog when looking for a particular regex solution. Someone on StackOverflow posted a solution with a link to your interactive RegEx editor. Thank you for making that, I’ve been trying to teach people how to use regexes and your tool is a great resource.

  4. Thanks for these! Is it possible to enable visual feedback as well?

  5. What about for OS 10.5.8 ? Any way to get these shortcuts/scripts to work properly with the standard keyboard?

  6. tried on os 10.7.3 , it seems not working.

  7. Grant Skinner April 30, 2012 at 7:23pm

    minqi – it’s working for me on 10.7.3. Sadly, it’s not 100% reliable (OSX doesn’t always seem to register custom key combos correctly), but it works most of the time.

  8. The scripts themselves seem to be flawless… now OSX is another matter. If you think something is broken test it in Automator- you will probably find (like I did) that the scripts are fine, it’s the binding and running in OSX that presents an issue. Thanks for your work!

  9. [SOLUTION] 10.8.4 here, got this to work by adding “return input” to the end of the run hook in each workflow. See screenshot here: http://i.imgur.com/BsbMXqL.png

  10. Helped.Thanks!!

  11. Hey this works great, thank you!

  12. Jeremy Rosenblatt October 19, 2023 at 2:22am

    Hi, I am using IOS 10.15.7. I have downloaded your scripts but I cannot see within services that they have installed properly. Any advise would be appreciated.

Comments are closed.