Configure Tooltip properties in Cocoa applications

Nov 14, '06 07:30:04AM

Contributed by: Anonymous

Tooltips are those 'helpful' yellow tags containing messages that sometimes appear when the mouse pointer hovers over controls in many programs. For various reasons, I sometimes find aspects of their implementation to be unsatisfactory. Fortunately, it turns out to be possible to tweak tooltip characteristics (at least in Cocoa apps) to some extent, by adding various properties to the .GlobalPreferences.plist file, or an individual program's .plist file.

Some of the available properties (their functions are more or less self-explanatory) include:

Key Data type Value / description
NSInitialToolTipDelay -int Time delay (milliseconds?)
NSToolTipAutoWrappingDisabled -bool true or false
NSToolTipsFont -string font name
NSToolTipsFontSize -int font size
For example, to generally reduce the incidence of accidentally triggering unwanted tooltips in Cocoa apps, the amount of time the mouse pointer has to hover before a tooltip initially appears can be lengthened by entering the command below in
$ defaults write -g NSInitialToolTipDelay -int 10000
Note that this will only affect programs launched after the change is made.

To set a separate, shorter delay for the appearance of Spotlight menu tooltips, and also prevent line wrapping to improve legibility of the 'path' info in tooltips for items in the search results, try these changes:

$ defaults write \
NSInitialToolTipDelay -int 1
$ defaults write \
NSToolTipAutoWrappingDisabled -bool true
The keys themselves all work in both 10.3 and 10.4 (earlier versions not tested), with the exception of NSToolTipAutoWrappingDisabled, which seems to cause the tooltip to appear as a tiny square in 10.3.

Some properties may have other unexpected effects in some apps. For example, in the web browser Shiira 1.2.2, changing the NSToolTipsFontSize changes the font size of the address field and bookmark bar. I'll call it a feature, since a smaller size allows more bookmarks to be added to the bookmarks bar! In 10.3, the font size of dialogues in some Apple apps is affected by changes to NSToolTipsFontSize.

If the results are unsatisfactory, the changes can be reversed using the appropriate defaults delete... command, or at worst, by deleting the corresponding .plist file from the user's ~/Library/Preferences folder.

Comments (5)

Mac OS X Hints