tags:

views:

856

answers:

3

I want to write a Songbird extension binds the multimedia keys available on all Apple Mac OS X platforms. Unfortunately this isn't an easy google search and I can't find any docs.

Can anyone point me resources on accessing these keys or tell me how to do it?

I have extensive programming experience, but this will be my first time coding in both MacOSX and XUL (Firefox, etc), so any tips on either are welcome.

Please note that these are not regular key events. I assume it must be a different type of system event that I will need to hook or subscribe to.

A: 

xev might help you if you want to find out which codes are being sent by multimedia keys.

cubex
Thanks for the suggestion, but xev does not receive the multimedia key events. These are not normal key events, Ukulele for example is not able to receive or reassign them.
Jonah Braun
+1  A: 

Are you sure your multimedia keys are working in your installation? Every single key generates a scan code which is translated into a key code by the kernel. If xev doesn't show you any keycodes I guess those scan codes aren't mapped and so the kernel has no knowledge of them.

http://gentoo-wiki.com/HOWTO_Use_Multimedia_Keys has a nice explanation of finding key codes and offers help on how you can find raw scan codes and translate them into key codes.

VVS
+2  A: 

This blog post has a solution:

http://www.rogueamoeba.com/utm/posts/Article/mediaKeys-2007-09-29-17-00.html

You basically need to subclass NSApplication and override sendEvent,
looking for special scan codes. I don't know what songbird is, but if it's
not a real application then I doubt you'll be able to do this.

Or maybe you can, a simple category may suffice:

@implementation NSApplication(WantMediaKeysCategoryKBye)
- (void)sendEvent: (NSEvent*)event
{
    // intercept media keys here
}
@end
Rhythmic Fistman