ResExcellence www
Powered by Google


Files are in Stuffit 5 or greater format.
FREE download.

Tell us about a bad link.

Thank You!


Running 6 days
without a restart.

Setting Custom Keyboard Shortcuts in Cocoa Applications by Josh Zerin

Sometimes, there's a menu command that you find yourself using in a particular application. But for some reason, the developer didn't assign it a shortcut key, or perhaps the one he did specify is confusing, conflicting or just plain silly. Apple creates a new shortcut for an application's Preferences dialog with every program they release, etc.

In MacOS 9, the process was as simple as opening up your handy-dandy copy of ResEdit and changing resources, one menu at a time. Fortunately, in MacOS X, it's a lot easer -- and more fun!

Important! This mod only works on Cocoa applications, and you must have Apple's developer tools installed. Note that QuickTime Player/Pro, DVD Player and iTunes are Carbon apps. This mod will not work for these applications.

Ok, let's get started:

1. Navigate to your favorite app, control-click on it and select "Show Package Contents":

2. Find the localization folder that you wish to modify (for English-speakers, that's "English.lproj"), then open the main nib file.

For most applications, the file you are looking for will be called "MainMenu.nib". However, for some (generally Apple) packages, the file will be called something like "Edit.nib" (see left), "Main.nib", or perhaps you will see a plethora of files, and none of them seem to be the right one. Just go with your instincts, and look at step 3 to see what you're looking for in the nib file.

If you don't see any nib files and instead only find "Localized.rsrc", you're looking at a Carbon app. Carbon apps can't be modified this way. Sorry.


 

 

3. Regardless of what the main nib file is called, you're looking for an instance of "MainMenu" (see right). If it's not there, you're in the wrong nib. Keep looking in that .lproj folder. It's in there somewhere.

Double-Click on MainMenu to make the menu editor active. You may need to move or close some windows to make the menu visible, but don't close the nib's window! This will close all windows for the nib file, and you'll have to start over!

 Select the menu command that you wish to modify....

 

4. Then set or change the Key Equivalent in the Inspector panel.

(If the Inspector Panel is not open, you can open it by selecting "Show Info" in the Tools menu. Or you can press Command+Shift+I... if you haven't changed it!)

You can set modifier keys with the three checkboxes below the Key Equivalent. They are Shift, Option and Control (respectively).

You can use any letter, number or symbol that can be produced by your keyboard and recognized by your computer. It is recommended that you test the interface (in the File menu or Command+R) before you save and quit to make sure you're not assigning the same shortcut to two different menu commands!


5. Feel free to change/set as many keyboard shortcuts as you want. Once you're satisfied, save the nib file. If you get an dialogue asking which format to use when saving the file, click on "Use Document Format."

6. Open up your newly-modified application and try out your new keyboard shortcuts!

That's it for now. Stay tuned for more!

Submitted by Josh Zerin ("Inspired") on 03/14/2003
http://www.inspired-tmu.com/


Maintained by the Staff of ResExcellence. This entire site ©1997-2005 ResExcellence
Privacy Statement? Sure we gotta Privacy Statement.