Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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.

share|improve this question
    
The answer to this lies in rcd.app (Remote Control Daemon)... There are some good details in forums.macgeneration.com/mac-os-x/… , I can't believe the media keys just shell out Applescript. That's crazy! –  Jason Salaz Feb 4 '11 at 22:45
add comment

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
    
But, I don't want to remap them to do something else. I want to know how the OS is aware of what application to control using the same KeySyms every time. –  Jason Salaz Nov 10 '10 at 18:32
    
so you don't want to read the code then? –  Robert S Ciaccio Nov 10 '10 at 19:33
    
I'm going to try to do so, but this doesn't answer the question, it is a workaround. I am primarily interested in something that allows developers to use what I assume are native APIs (perhaps "private") in order to register primary media control, and receive multimedia (play/pause/forward/back/volume) events. I don't want to "fix the problem", I want to learn the low-level details of this process. –  Jason Salaz Nov 24 '10 at 7:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.