views:

32

answers:

1

I want to create a replacement for the app switcher (aka 'cmd + tab').

I know that it's possible because Lite Switch X does it.

What I've got achieved so far:

By force quitting the dock and calling CPSRegisterForKey() (which is a private API function) I can prevent the default cmd+tab from working.

The second step is two register the hot key for my app. The standard way of doing this, RegisterEventHotKey(), doesn't work. A bit of googling and GDBing suggests that the Dock and Lite Switch X use CGSSetHotKeyEnabled() and CGSSetHotKey() (both of these are private API functions). The problem I have is that I do not know what arguments these functions take.

How can I determine the arguments for a private API function?

Update:

I've got a little further with CGSSetHotKey():

OSErr setupResult = CGSSetHotKey(_CGSDefaultConnection(), unknownArg, unknownArg, unknownArg, kCGEventFlagMaskCommand, ???, ???, ...);

+1  A: 

Have you tried using class-dump? It's usually pretty helpful.

Jeff Kelley
Close but no cigar! The calls are all plain-old C, not Objective-C. However, it was still useful. Thanks!
Benedict Cohen
Whoops! You're absolutely correct. You could use `gdb` to attach to Finder, as you've done, but then you don't have symbols for these shared libraries. An interesting challenge…
Jeff Kelley