O'Reilly logo

Modding Mac OS X by Erica Sadun

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

New Ways to Define Keyboard Shortcuts

As previous chapters showed, you can edit your preferences files with any number of tools. These tools include—but are not limited to—TextEdit, Property List Editor, and the command-line defaults utility. (Of course, you could also use the Unix text editors vi, Emacs, or pico if you wanted to edit the plist files from the command line.) It doesn’t really matter which of these tools you use. Many of them offer more power and flexibility than the Keyboard Shortcuts preferences pane; however, they’re also less forgiving. Because of their greater power, each of these tools opens up the possibility of iatrogenic (which is a fancy way of saying “hack-induced”) errors. So take extra care when using these utilities.

Editing the defaults database or preferences plist file directly allows you to add any shortcut you want, whether or not it breaks the “rules” enforced by the Keyboard Shortcuts preferences pane. These rules are enumerated earlier in this chapter in the section “Changing the Keyboard Shortcuts.” For example, the Keyboard Shortcuts pane won’t let you add ⌘-C or the Delete key to a shortcut; but you can add them by directly editing the plist. With direct editing, you can even assign a keyboard shortcut to the number 2. (Why you’d want to do this is another matter entirely, but it should mostly be reserved for those times when you really want to annoy someone.)

All keyboard shortcuts are stored in the NSUserKeyEquivalents dictionaries. These ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required