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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access