Mac Modding Shortcuts
by Erica Sadun|
Related Reading
Modding Mac OS X |
Editor's note: Make repetitive tasks simpler and maximize ergonomic efficiency with this excerpted chapter from Erica Sadun's Modding Mac OS X. This comprehensive chapter covers everything from the philosophy of keyboard shortcuts to step-by-step instructions to a look at speakable items, complete with shortcut management tips and screenshots. Neat, concise, and easy-to-use, this excerpt helps you add, remove, and change keyboard shortcuts to meet your personal computing needs. Keep your hands on the keyboard and give that mouse a rest.
Adding Application Keyboard Shortcuts
The Keyboard Shortcuts preferences pane lets you associate a custom shortcut for any menu item in any or all of the applications on your Mac. This feature lets you add a new menu shortcut or override the original keyboard shortcut for a menu item. You can also add shortcuts to individual applications or globally to all applications, as described in the following section.
All application shortcuts in this chapter are case-sensitive. Always take care to match the case, spelling, spacing, and punctuation when defining a shortcut. Non-English-language readers: please note that you will need to adapt the instructions in this chapter to match the exact text on your system. For example, French-language readers do not use Secure Empty Trash. The menu item title is Vider la Corberille en mode sécurisé.
|
TOOLS YOU NEED
For working through the examples in this section, you’ll need the
following applications:
|
Adding a Shortcut to an Application
Apple’s infinitely hackable Calculator (/Applications) offers no keyboard shortcut for turning speech recognition on or off. As Figure 8-5 shows, the two-item Speech menu has no keyboard shortcuts at all. In the following steps, you’ll use the Keyboard Shortcuts preferences to add a shortcut for the Speak Total menu option.
![]() Figure 8-5. The default look for Calculator's Speech menu. |
- Quit Calculator with Apple-Q if it is running. You cannot correctly assign shortcuts when an application is active.
- Open the Keyboard Shortcuts preferences pane.
- Locate the small plus button (+) at the bottom-right of the Keyboard Shortcuts pane; it’s just above the “Turn on full keyboard access” checkbox. Click the + button; a dialog scrolls down out of the titlebar, as shown in Figure 8-6.
- Select Calculator from the Application pop-up list.

Figure 8-6. Clicking the + button opens this dialog on top of the Keyboard Shortcuts pane. - Enter “Speak Total” into the poorly named Menu Title field. (This field actually holds the name of the menu item to be referred to, not the title of the entire menu.) Make sure to use the exact spelling, case, spacing, and punctuation to match the name of the menu item correctly. Do not add extra spaces at the end of the name.
- Tab down to the Keyboard Shortcut field and type Option-T. Note that the same caveats about selecting legal shortcuts apply here as well as to the built-in shortcuts described earlier in this section. For example, Keyboard Shortcuts won’t let you set your shortcut to Apple-T, T, or Shift-T.
- Click Add, as shown in Figure 8-7. The new keyboard shortcut appears as
a new section under Application Keyboard Shortcuts, below All Applications.

Figure 8-7. Specifying the Application, Menu Title (really, the menu item), and Keyboard Shortcut. - Launch Calculator, open the Speech menu, and confirm that the new shortcut appears and works as expected. Figure 8-8 shows the updated menu after making the change.
- In order to examine how your changes have affected the default settings
for Calculator, it helps to search through your preferences. You can best
do this by using the
defaultsutility, which runs from the command line. Start by launching the Terminal application (/Applications/Utilities). -
Enter defaults read com.apple.calculator. This command requests a list of the defaults (preferences) from the com.apple.calculator property list file, which stores all the preferences used by Calculator. The new keyboard shortcut appears, associated with the
NSUserKeyEquivalentskey (highlighted in bold in the output).
Figure 8-8. The modified Speech menu. Speak Total now has a keyboard shortcut.$ defaults read com.apple.calculator { NSUserKeyEquivalents = {“Speak Total” = “~T”; }; "NSWindow Frame Calc_History_Window" = "419 344283 0 0 1024 746 "; "NSWindow Frame Calc_Main_Window" = "113 459283 0 0 1024 746 "; PaperTapeVisibleDefaultsKey = 0; PrecisionDefaultsKey = 13; SpeaksButtonPressedDefaultsKey = 0; SpeaksTotalDefaultsKey = 0; ViewDefaultsKey = Basic; "dv com.apple.soundmgr._DV Sound Output Settings" = <7d000000 >; } -
Any item that returns from the
defaultscommand will also appear in the actual preferences plist file associated with that domain. When opened in TextEdit, you’ll find the same updated preference. To see them, launch TextEdit and open ~/Library/Preferences/com.apple.calculator. plist.<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC “-//Apple Computer//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”> <plist version=”1.0”> <dict> <key>NSUserKeyEquivalents</key> <dict> <key>Speak Total</key> <string>~T</string> </dict> <key>NSWindow Frame Calc_History_Window</key> <string>419 344283 0 0 1024 746 </string> <key>NSWindow Frame Calc_Main_Window</key> <string>113 459283 0 0 1024 746 </string> <key>PaperTapeVisibleDefaultsKey</key> <false/> <key>PrecisionDefaultsKey</key> <integer>13</integer> <key>SpeaksButtonPressedDefaultsKey</key> <false/> <key>SpeaksTotalDefaultsKey</key> <false/> <key>ViewDefaultsKey</key> <string>Basic</string> <key>dv com.apple.soundmgr._DV Sound Output Settings</key> <data> fQAAAA== </data> </dict> </plist>
|
Editing Application Shortcuts
Use the following tricks to edit the application shortcuts in your Keyboard Shortcuts preferences pane:
|
Pages: 1, 2 |


