of OS X will rule out even the gdb technique for finding new defaults write strings. Just Getting Started The work has only just begun once the gdb script dumps a list of what it thinks are preference keys. Every one of them—and there will be hundreds—must be examined for anything that looks interesting. Suddenly you’re not just feeling around in the dark for the light switch. Now you’re wearing boxing gloves too. Finding interesting stuff takes lots of time, plus pure intuition and common sense. It can help to know Apple’s codenames for certain features: MeetingRoom appears to refer to AirDrop, for example (and is a better name if you ask me). Ubiquity refers to iCloud. Springboard refers to Launchpad. For what it’s worth I figured out these by guesswork, plus trial and error. Once you identify a key that looks interesting, you then have to work out whether it takes a string value, an integer, or (most likely of all) a Boolean value. This can be done by testing it out on a working system using the defaults write command. At this point you’ll also see what effect—if anything—applying the new key actually has. Does it do anything at all? Perhaps its effect is so subtle that it’s nearly impossible to spot, or maybe it relates to the smallest functionality of an already very minor function. The only way to find out is to play with the app in question—click this, then that, and set this function working, and stop that other function. Did I mention that this can be mind-bendingly difficult work? But on the other hand, finding something awesome makes it all worthwhile. Keys can be removed from the preferences plist file using the defaults delete command. Hack Categories Experience has shown me that keys uncovered by gdb fall into one of a few categories. Firstly, they might be keys that you can already set via the Preferences dialog. gdb finds these too, and this can catch out the unwary hacker who might believe he’s stumbled upon a gem when, in fact, that same gem is just a few clicks away for every single user. Secondly, the preference key might simply be a dud. It doesn’t do anything. This might be because either gdb has returned something that isn’t actually a preference key, or the key is an orphan—it was connected to something once upon a time, but not any longer. There do seem to be many preference keys from very early versions of OS X that simply haven’t been removed when the functionality moved on. Some might even date from the NeXTSTEP days, from where OS X inherited its preferences system. Thirdly, the preference key does something but it’s not very interesting or useful. A lot of keys relate to diagnostics and testing of the app in question, or are simply related to the internal plumbing of OS X (configuring the app to work with a particular API, for example). Recently I discovered a key that displayed within Finder the frame rate of Cover Flow animations within Finder (which I wrote up for the OS X Hints site [U4]). It’s hard to imagine how this could ever be useful to anybody other than somebody working at Apple, but it was pretty cool nonetheless. PragPub January 2013 24
Previous Page Next Page