(This is not a question about KVC/KVO and key-value bindings.)
I'm writing an application with a "tools" panel. Every tool can be selected using one-letter key (like "M" - "Move tool"). Tool can be selected even when there is no main window and the tools panel is not selected (not being "key").
Docs say that raw key events are not propagated to the app delegate and document controller (so I cannot rely on onKeyDown since it should happen in a WindowController). But "action events" (keys bound to a selector) are sent to the app, app delegate and document controller.
I know two ways to set such global bindings: through NSMenuItem key equivalents in Interface Builder or using ~/Library/KeyBindings/DefaultKeyBinding.dict file (which specifies global bindings for all apps).
Menu items approach is not good because I don't want to pollute my menu with commands which can be triggered from the tools panel.
I would like to set such bindings programmatically or specify them in a bundled KeyBindings.dict like Xcode and TextMate do.
However, I couldn't find docs or examples how to name such dict file and how to connect it to the app. Xcode uses PBKeyBinding.dict filename, TextMate uses KeyBindings.dict. There's no option for Info.plist to tell app to read the dict file.
Does anybody know how this could be done?
Thanks.