gSkinner - Home

Media Keys In OSX For Any Keyboard

Posted on October 26, 2011 by Grant Skinner

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.

Follow @gskinner on Twitter for more news and views on interactive media.
11 Comments

Download seems to be broken

Posted by: Arul on Oct 27, 2011 12:34am URL: http://luracast.com

Fixed.

Posted by: Grant Skinner on Oct 27, 2011 7:52am

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.

Posted by: Dan on Oct 30, 2011 8:01am URL: http://danwin.com

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

Posted by: Andreas on Feb 9, 2012 4:49am

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

Posted by: Glen on Feb 22, 2012 1:53pm

tried on os 10.7.3 , it seems not working.

Posted by: minqi on Apr 30, 2012 6:29pm

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.

Posted by: Grant Skinner on Apr 30, 2012 7:23pm

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!

Posted by: Jacob Beach on Dec 9, 2012 1:48pm URL: http://HistoryReborn.com

[...] http://gskinner.com/blog/archives/2011/10/media-keys-in-osx-for-any-keyboard.html [...]

Posted by: How Do I Control The Syst… on Apr 20, 2013 9:19pm URL: http://www.eonlinegratis.com/2013/how-do-i-co…

[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

Posted by: Garrett on Jun 22, 2013 10:02pm URL: http://garrettf.com

Helped.Thanks!!

Posted by: Azhagu vel on Jan 27, 2014 10:26am

Leave a Reply

Your email is never published nor shared.




You may use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>