< Day Day Up > |
Managing User PreferencesYour preferences, located in ~/Library/Preferences are plist files, a form of XML file. In this section we will take a look at some sample plist files and learn ways to manage them. Listing 16.1 shows the Terminal.app preference file (located in ~/Library/Preferences/com.apple.Terminal.plist) from an installed, but little-used user account. Listing 16.1. An Almost Bare Preference File for Terminal.app<?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>StartupFile</key> <string></string> </dict> </plist> The terminal preferences currently contain little of interest other than a reference to a startup file.
Listing 16.2 shows the Terminal.app preferences from a considerably more used account. As you can see, the plist files are not required to contain all the preferences for an application and can grow as the user specifies more preferences that aren't just the defaults. One annoyance that this causes is that sometimes hidden preferences aren't accessible through any of the application's Preferences panes. These preferences can find their way into the XML plist files only if somebody discovers their existence and adds the preference line to the plist file manually. Listing 16.2. A Preferences File for Terminal.app That Has Accumulated Some Settings over Time<?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>AutoFocus</key> <string>YES</string> <key>Autowrap</key> <string>YES</string> <key>BackgroundImagePath</key> <string></string> <key>Backwrap</key> <string>YES</string> <key>Bell</key> <string>YES</string> <key>BlinkCursor</key> <string>YES</string> <key>BlinkText</key> <string>YES</string> <key>CleanCommands</key> <string>rlogin;telnet;ssh;slogin</string> <key>Columns</key> <string>118</string> <key>CursorShape</key> <string>0</string> <key>CustomTitle</key> <string>Terminal</string> <key>DeleteKeySendsBackspace</key> <string>NO</string> <key>DisableAnsiColors</key> <string>NO</string> <key>DoubleBold</key> <string>YES</string> <key>DoubleColumnsForDoubleWide</key> <string>NO</string> <key>DoubleWideChars</key> <string>YES</string> <key>EnableDragCopy</key> <string>YES</string> <key>ExecutionString</key> <string></string> <key>FontAntialiasing</key> <string>NO</string> <key>FontHeightSpacing</key> <string>1</string> <key>FontWidthSpacing</key> <string>1</string> <key>IsMiniaturized</key> <string>NO</string> <key>KeyBindings</key> <dict> <key>$F708</key> <string>ESC[25~</string> <key>$F709</key> ... <key>~F712</key> <string>ESC[34~</string> </dict> <key>Meta</key> <string>-1</string> <key>NSColorPanelMode</key> <string>6</string> <key>NSColorPanelVisibleSwatchRows</key> <integer>1</integer> <key>NSFixedPitchFont</key> <string>Monaco</string> <key>NSFixedPitchFontSize</key> <real>10</real> <key>NSFontPanelPreviewHeight</key> <real>0.0</real> <key>NSWindow Frame Inspector</key> <string>102 311 268 435 0 0 1024 746 </string> <key>NSWindow Frame NSColorPanel</key> <string>325 263 201 309 0 0 1024 746 </string> <key>OptionClickToMoveCursor</key> <string>NO</string> ... <key>TermCapString</key> <string>xterm-color</string> <key>TerminalOpaqueness</key> <real>1</real> <key>TextColors</key> <string>1.000 1.000 1.000 0.000 0.000 0.000 1.000 1.000 1.000 1.000 1.00 0 1.000 0 .000 0.000 0.000 1.000 1.000 1.000 0.667 0.667 0.667 1.000 1.000 1.000C </string> <key>TitleBits</key> <string>78</string> <key>Translate</key> <string>YES</string> <key>UseCtrlVEscapes</key> <string>YES</string> <key>VisualBell</key> <string>NO</string> <key>WinLocULY</key> <string>471</string> <key>WinLocX</key> <string>67</string> <key>WinLocY</key> <string>0</string> <key>WindowCloseAction</key> <string>1</string> </dict> </plist> Listing 16.3 shows a preferences file for a shareware product called GraphicConverter. As you can see in Listings 16.2 and 16.3, the items stored in the ~/Library/Preferences/ files are many and varied. You also can see that some preferences are not intuitively parseable.
Listing 16.3. The plist File for GraphicConverter<?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>AppleNavServices:ChooseFolder:0:HomeDirectoryPath</key> <string>file://~/Documents/</string> <key>AppleNavServices:ChooseFolder:0:Path</key> <string>file://localhost/MacHD/Users/joray/Documents/</string> <key>AppleNavServices:ChooseFolder:0:Position</key> <data> ATkBaA== </data> <key>AppleNavServices:ChooseFolder:0:Size</key> <data> AAAAAAFvAjA= </data> <key>AppleRecentFolders</key> <array> <string>file://localhost/MacHD/Users/joray/Documents/</string> </array> ... <key>custom color table</key> <data> /////////////8zM/////5mZ/////2Zm/////zMz/////wAA///MzP/////MzMzM///M zJmZ///MzGZm///MzDMz///MzAAA//+Zmf////+ZmczM//+ZmZmZ//+ZmWZm//+ZmTMz //+ZmQAA//9mZv////9mZszM//9mZpmZ//9mZmZm//9mZjMz//9mZgAA//8zM/////8z M8zM//8zM5mZ//8zM2Zm//8zMzMz//8zMwAA//8AAP////8AAMzM//8AAJmZ//8AAGZm //8AADMz//8AAAAAzMz/////zMz//8zMzMz//5mZzMz//2ZmzMz//zMzzMz//wAAzMzM zP//zMzMzMzMzMzMzJmZzMzMzGZmzMzMzDMzzMzMzAAAzMyZmf//zMyZmczMzMyZmZmZ zMyZmWZmzMyZmTMzzMyZmQAAzMxmZv//zMxmZszMzMxmZpmZzMxmZmZmzMxmZjMzzMxm ZgAAzMwzM///zMwzM8zMzMwzM5mZzMwzM2ZmzMwzMzMzzMwzMwAAzMwAAP//zMwAAMzM zMwAAJmZzMwAAGZmzMwAADMzzMwAAAAAmZn/////mZn//8zMmZn//5mZmZn//2ZmmZn/ /zMzmZn//wAAmZnMzP//mZnMzMzMmZnMzJmZmZnMzGZmmZnMzDMzmZnMzAAAmZmZmf// mZmZmczMmZmZmZmZmZmZmWZmmZmZmTMzmZmZmQAAmZlmZv//mZlmZszMmZlmZpmZmZlm ZmZmmZlmZjMzmZlmZgAAmZkzM///mZkzM8zMmZkzM5mZmZkzM2ZmmZkzMzMzmZkzMwAA mZkAAP//mZkAAMzMmZkAAJmZmZkAAGZmmZkAADMzmZkAAAAAZmb/////Zmb//8zMZmb/ /5mZZmb//2ZmZmb//zMzZmb//wAAZmbMzP//ZmbMzMzMZmbMzJ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<key>serial 2</key> <string></string> <key>string 0</key> <string></string> <key>string 1</key> ... <key>string 23</key> <string></string> <key>string 24</key> <string>Movie</string> <key>string 25</key> <string>YYYY-MM-DD HH.NN.SS</string> <key>string 26</key> <string>THM TXT HTM HTML EXE DLL P C PAS CC ASM COM SYS LST DOC XLS PST OST INI PPT INF SIT ZIP TAR MIM GZIP ARJ</string> <key>string 27</key> <string>THM TXT HTM HTML EXE DLL P C PAS CC ASM COM SYS LST DOC XLS PST OST INI PPT INF SIT ZIP TAR MIM GZIP ARJ</string> <key>string 28</key> <string></string> <key>string 29</key> <string>n-cc-rr.x</string> <key>string 3</key> <string>en</string> <key>string 30</key> <string>target="_blank"</string> <key>string 31</key> <string>ftp://</string> <key>string 32</key> <string></string> <key>string 33</key> <string></string> <key>string 34</key> <string>/</string> <key>string 35</key> <string>grab</string> ... </dict> </plist> As we mentioned, some application preferences are hidden. However, if you are interested, you can spend some time discovering possible preferences. Using the strings command can assist in discovering hidden preferences. You see a list of all textual strings in the program. It's reasonable to expect that for the program to read strings out of a .plist file, it must contain the string, so the strings found in the program make for potentially interesting things to try as preferences. For example, to try to discover some of the available hidden preferences in the Dock, you might run strings /System/Library/CoreServices/Dock.app/Contents/MacOS/Dock | more Some of the output you get includes the following excerpts: __dyld_mod_term_funcs __dyld_make_delayed_module_initializer_calls __dyld_image_count __dyld_get_image_name __dyld_get_image_header __dyld_NSLookupSymbolInImage __dyld_NSAddressOfSymbol libobjc __objcInit The kernel support for the dynamic linker is not present to run this program. showhidden showshadow DoesPointToFocusCursorUpdate ClientMayIgnoreEvents com.apple.finder DockProxyPSNLoHack en_US Info.plist trashlabel owensdock dock .dock AppleShowAllExtensions AppleShowAllFiles notfound trashfull trashempty finder openfolder wvousfloat wvousfloatselected wvouscornertl wvouscornertr wvouscornerbl wvouscornerbr shadow /System/Library/CoreServices/Finder.app SetsCursorInBackground .app autohide magnification /System/Library/PreferencePanes/Dock.prefPane poof.png ... TrashName TrashRemoveFromDock Trash Remove From Dock default.plist com.apple.dock version persistent-apps ... orientation bottom left right pinning middle start mineffect genie scale suck ... size-immutable magnify-immutable autohide-immutable position-immutable mineffect-immutable contents-immutable ... As you can see, the resulting output contains a variety of items, from comments to filenames to possible preference names and possible preference values. From the output, we might guess that orientation is a preference and that possible values are bottom, left, or right. We might also guess that mineffect is another preference with possible values of genie, scale, or suck. From the Dock control pane, however, we have only the choices of genie or scale, so we've probably already discovered a sort of hidden preference. In that same section of output is pinning, which looks as if it might have possible values of middle or start. In the final section of the shown output, a number of entries that end in immutable, making it seem as if there might be a way to set some preferences so that they don't change. Without experimenting, though, we can't be sure what behavior, if any, to expect. In the middle, there's an entry for poof.png, which is an image file wonder if that's the Dock "poof" for when you remove things from it by dragging, and whether we could customize that little animation by finding and editing this graphics file? Instead of requiring you to edit XML files directly, Apple has provided a convenient command-line program for editing the preferences stored in these files. The defaults command allows you to specify a preference to be modified and a value with which to modify it. If the application whose preferences you are trying to modify is currently running, restart the application. As an example of the defaults command in use, the following command pins the Dock at the beginning side of the Dock, as shown in Figure 16.1: defaults write com.apple.dock pinning start Figure 16.1. Here is an example of the Dock with the pinning preference set to start.Specifically, this command modifies the preference pinning in the file ~/Library/Preferences/com.apple.dock.plist and sets the value to start. Logging out and logging back in is one way to cause changes to the Dock to take effect. More easily, you can run killall Dock. Now this file contains these lines: <key>pinning</key> <string>start</string> If you decide you don't like the pinning that you've just enable, you can always remove it. To remove the change run: defaults delete com.apple.dock pinning killall Dock Suppose that you don't want to have available the option to hide the Dock. You might try enabling the autohide-immutable item we saw earlier in the output by using the following command: defaults write com.apple.dock autohide-immutable -bool true The command modifies the preference autohide-immutable to have the Boolean value true by adding these lines to the file: <key>autohide-immutable</key> <true/> In the Dock control pane, the option to hide the Dock is no longer available, and the option no longer appears under the Apple menu. Figure 16.2 shows the modified Dock control pane. Figure 16.2. After setting the autohide-immutable preference to true, the option to hide the Dock is no longer available.As you have seen, preferences files can vary in their complexity. You might sometimes find it easier to edit the actual plist file or use the graphical /Developer/Applications/Utilities/Property List Editor.app. For example, from the earlier strings output on the Dock preferences, we notice the persistent-apps string. This suggests that there might be a way to remove icons that permanently appear in the Dock. However, just from the persistent-apps string, it is difficult to guess what you might have to do to remove one of those icons. Because that section in the ~/Library/Preferences/com.apple.dock.plist file also looks complicated, it might be difficult to guess what the appropriate defaults command may be. However, in your favorite text editor, or in the Property List Editor, you can easily locate the section for the application you no longer want to have in your Dock and simply delete it. Figure 16.3 shows removing the AddressBook section of the persistent-apps section of the file using the Property List Editor. You can tell that item 4 of the persistent-apps section, the item to be removed, is the Address Book based on the file-label value. Figure 16.3. Using the Property List Editor to remove the Address Book icon from the Dock.Unfortunately, Apple hasn't provided a definitive list of preferences options for each application. Even a listing of the options that each file contains would not be complete because some applications accept preferences that are not yet stored in the XML files. There are preferences options that some programs take as defaults but that can be overridden by the insertion of specific preferences into the XML files. Because no current preference is stored, we can only make intelligent guesses as to what preference names and values might be accepted. As a matter of fact, making intelligent guesses is exactly what the online community is doing regarding these preferences. With this brief look at discovering and manipulating some preferences in the Dock, you can also start to make some intelligent guesses regarding preferences. Table 16.1 lists a number of preferences options that have been reported to be interesting, when configured using the defaults command. Not all these have known or well- documented functions. We have primarily tested those for the Finder and the Dock. In our testing of the NSUserKeyEquivalents preference, we had success in building key equivalents with the Command and/or Shift characters. However, we list all the reported information on <keystring> values, in case it should indeed prove useful. Figure 16.5 shows Terminal.app's Terminal menu modified so that About Terminal, which normally does not have a keyboard equivalent, now has a keyboard equivalency of Shift-Command-b. You can set this particular equivalency by running this defaults command: defaults write com.apple.Terminal NSUserKeyEquivalents '{"About Terminal"="$@b";}'
Figure 16.4. About Terminal under the Terminal menu of Terminal.app now has a keyboard equivalency of Shift-Command-b after issuing the appropriate defaults command.Table 16.2 shows select documentation for the defaults command. Note that not only can you use the defaults command to write preferences, but you can also use it to read, delete, and search preferences.
|
< Day Day Up > |