Multimedia Key Binding

ituneskeynoteremote control

How exactly does Apple "register" the multimedia keys? I notice that Play/Pause, Rewind, and Fast-Forward are active Application aware. By which I mean that it will control Front Row, or iTunes, DVD Player, or Keynote, all uniquely, not at the same time if all of them are open.

How exactly is this registered? And can it be "extended" to work with other applications?

(Obviously all the rest of the function keys are of a more "global scope" and aren't really involved here.)

[edit]
I'm revisiting this question, because I've seen it come up a couple of times now that I'm discovering things like Vox.app and the like, but I'm still a bit stumped as to how the process can be so "intelligent".

If you browse to /System/Library/CoreServices/rcd.app/Contents/MacOS and run something like strings, less, vim, or any hex utility against rcd, you'll see some very interesting things. Namely, embedded/hard coded AppleScript.

To the best of my knowledge, this daemon controls the IR remotes, as well as the media keys on the keyboard. Given that some key events (Play/Pause, Fast Forward, etc.) are shared between multiple apps (iTunes, Front Row, Keynote, to name a few), I still want to know how the correct one is "chosen" to receive the event from rcd.

I assume this to mean that, in order to "extend" rcd to other apps, you would have to break codesign validation, and directly alter the binary in some scary perplexing manner.

Best Answer

You might want to look at the code for KeyRemap4MacBook. There is functionality in there for remapping these keys to whatever you like, I'm not sure however if it would become clear how to "register" those keys.

Related Question