MacOS – sane way to emulate the newer media key behavior completely on an Apple Extended Keyboard II

applescriptkeyboardmacos

The operative word here being "completely". I recently found a nearly flawless (cosmetically and functionally) AEKII (Alps, not Mitsumis) on eBay and won it for $30. It's an awesome keyboard and it gives me fond memories of my typing classes in elementary school, but I hate the lack of modern media keys; I used them all the time on my wired Aluminum keyboard.

My current "hack" involves some custom AppleScripts (I've only implemented volume up/down) that I imported as Alfred Extensions and bound to some custom hotkeys, but this approach has some downsides:

  • No system feedback; the volume overlay and sound effect don't show up. And I'm fairly noobish when it comes to AppleScripting so I have yet to figure out if it's possible to do this.
  • Because it's a script and not a true hardware interrupt, things like system load can lead to delays in responding to the key presses.
  • I can't hold down the key to affect a continuous increase or decrease. I have to repeatedly hit the keys to repeatedly increment or decrement the volume value.

I'd imagine that there is a way to write an AppleScript that captures keypresses and I can use that to process a continuously depressed key, but I haven't found it worthwhile to spin a bunch of cycles trying to figure this out.

Are there any other AEKII users out there that have found a sane way to handle special functions from the keyboard?

Best Answer

You could try KeyRemap4MacBook:

or FunctionFlip:

If neither works, you could also try creating a private.xml in KeyRemap4MacBook:

<?xml version="1.0"?>
<root>
<item>
<name>Change F-keys</name>
<identifier>0A0FE074-9C9C-43DC-8AEB-6683C5CB3259</identifier>
<autogen>--KeyToKey-- KeyCode::F1, KeyCode::BRIGHTNESS_DOWN</autogen>
<autogen>--KeyToKey-- KeyCode::F2, KeyCode::BRIGHTNESS_UP</autogen>
<autogen>--KeyToKey-- KeyCode::F3, KeyCode::MISSION_CONTROL</autogen>
<autogen>--KeyToKey-- KeyCode::F4, KeyCode::LAUNCHPAD</autogen>
<autogen>--KeyToConsumer-- KeyCode::F5, ConsumerKeyCode::KEYBOARDLIGHT_LOW</autogen>
<autogen>--KeyToConsumer-- KeyCode::F6, ConsumerKeyCode::KEYBOARDLIGHT_HIGH</autogen>
<autogen>--KeyToConsumer-- KeyCode::F7, ConsumerKeyCode::MUSIC_PREV</autogen>
<autogen>--KeyToConsumer-- KeyCode::F8, ConsumerKeyCode::MUSIC_PLAY</autogen>
<autogen>--KeyToConsumer-- KeyCode::F9, ConsumerKeyCode::MUSIC_NEXT</autogen>
<autogen>--KeyToConsumer-- KeyCode::F10, ConsumerKeyCode::VOLUME_MUTE</autogen>
<autogen>--KeyToConsumer-- KeyCode::F11, ConsumerKeyCode::VOLUME_DOWN</autogen>
<autogen>--KeyToConsumer-- KeyCode::F12, ConsumerKeyCode::VOLUME_UP</autogen>
</item>
</root>

It might only work if you use the external keyboard with a laptop or have another keyboard connected. From ConsumerKeyCode ignored - Google Groups:

KeyRemap4MacBook requires at least one keyboard with functional keys (Volume Control, etc) when you want to change keys to functional keys.

If possible, please connect the Apple keyboard to iMac.

If you don't have another keyboard, please use Spark or Quicksilver or other apps to this purpose.