Determining Preference Keys

Editing preferences in the defaults database is a chicken-and-egg problem. Without knowing the key to set a preference for, it’s hard to customize an application’s behavior. Setting preference keys randomly won’t accomplish much except to fill your defaults database with useless data. To determine which keys can be set, you have to do a bit of research. Three methods will help you determine the preference keys an application might use:

  • Looking at the preference plist files after you’ve customized an application

  • Searching the Web

  • Digging into the application itself

The first of these methods is fairly self-explanatory. Simply fiddle with the various settings of the application and watch the plist file to see what changes. Once you have an idea of the ways that keys are named, you can use the defaults find command. This command searches through the defaults database and returns the preference file and data associated with any particular string. For example, if after tweaking the opacity of your Terminal windows, you searched for the string Opaque, you would find the key in the com.apple.Terminal domain, as shown in Example 14-11.

Example 14-11. Searching for a string in the defaults database

$ defaults find Opaque
Found 1 keys in domain 'com.apple.Terminal': {TerminalOpaqueness = 0.7783334; }

If other applications used keys with the string Opaque, they would also be listed.

The second of these methods is also straightforward—using the Web. The Mac OS X Hints web ...

Get Running Mac OS X Tiger now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.