To edit the text of the unlock window in Mac OS X 10.6 Snow Leopard
The default text of the unlock window, "To access this computer, you need to enter your password.", is contained within one of the .nib files in loginwindow.app and can be modified with certain limitations.
First, cd
to the proper directory:
cd /System/Library/CoreServices/loginwindow.app/\
Contents/Resources/English.lproj/BuiltInAuth.nib
The .nib we want to edit is keyedobjects.nib
. There are two ways to edit the file.
Editing the .nib file with a plaintext editor
First we have to convert the binary encoded .nib file to XML:
sudo plutil -convert xml1 keyedobjects.nib
Now edit keyedobjects.nib with any plaintext editor; I used vi. Remember to have root permissions when editing it, via sudo or whatever:
sudo vi keyedobjects.nib
Unfortunately, there's not a great way to definitively go directly to the proper entry. We're interested in item 40, but the objects are just entered sequentially without indexes. Fortunately, what we're looking for happens to be the first occurrence of the string "password". So just search for "password". You'll find the current text inside <string>
tags.
Actually, if you want to be a vi geek, you can enter the following sequence of vi commands:
1G41/^\t\t<[^/]
(Do not press return anywhere but at the end.)
What this does is go to the top of the document and then search for the 41st occurrence of a line that starts with two tabs and a left angle bracket that is not followed by a slash. This only works because plutil
formatted the xml in a particular fashion. We're searching for the 41st instead of the 40th because it's a zero-based array.
Editing the .nib file with Xcode
You can also edit .nib files directly with Xcode, but, IMO it's both not really that much easier in this instance, and harder to run with root permission, though it's doable if you're afraid of vi:
sudo /Developer/Applications/Xcode.app/Contents/MacOS/Xcode \
/System/Library/CoreServices/loginwindow.app/Contents/Resources/\
English.lproj/BuiltInAuth.nib/keyedobjects.nib
As stated above, we're interested in item 40, and Xcode does show you the item indices, so you can just scroll straight down to item 40 and you've found it.
Xcode does require that the .nib be in binary1 format, though, in order for it to interpret it as a .nib and give you the fancy interface, so if you want to do it that way, omit all of the "plutil -convert
" directions.
Editing the file without gaining root permissions
Well, you still have to have root permissions, but you can change the permissions of the file and not need to give root permissions to your editor, if you find that easier to deal with.
Either change (and later change back) the file permissions from the command line:
chmod o+w keyedobjects.nib
chmod o-w keyedobjects.nib
Or change them with the Finder's Get Info pane. You'll have to right-click and "Show Contents" on loginwindow and BuiltInAuth.nib to get to the file through the Finder, though.
Then you can use an editor, Xcode, vi, or whatever, without it needing to have root permissions.
Changing the text
Changing the text itself is pretty obvious. Just change it.
There does seem to be a limit on how much text the unlock window will display — it won't go beyond the two lines you see with the default, though you can fill up the second line — so be terse.
Also, if the text string is too long, it seems to break unlocking altogether; it won't display the unlock window at all. For example, a 447-character string did this to me. I don't know where the breakage starts, though.
If you want to start a new line at a particular place, there's no escape code or anything; just put a newline straight in there:
<string>line1
line2</string>
The proof is in the pudding, or some such:
Changing the Font (optional)
You can even change the font and point size from the default of 13pt LucidaGrande-Bold. Change item 42 (for a text editor, search for "LucidaGrande-Bold") to name whatever font you wish. (The Font Book application will show you available fonts; the format seems to be TypeFace-Weight with spaces stripped.) The point size is contained in the NSSize key just before the font declaration, in item 41.
Here's an example in 8pt Futura-CondensedMedium:
This image would tend to imply that the height limit is actually not two lines, but a particular pixel height. (Looks like about 34 pixels.) So, notionally, if you can find a font with a smaller height and smaller leading, you might be able to fit more full lines. (There might even be a key in the .nib file to change the display area height. I haven't looked, though.)
Final thoughts
That's it; you're done. It's not required, but if you converted it to xml and you really want, you can convert the .nib back to binary form:
sudo plutil -convert binary1 keyedobject.nib
You'll have to log out and back in to get it to take effect.
codesign
verification
This edit does affect codesign verification, though:
% codesign -vvvv /System/Library/CoreServices/loginwindow.app
/[...]/loginwindow.app: a sealed resource is missing or invalid
/[...]/loginwindow.app/[...]/keyedobjects.nib: resource modified
I don't know what effect that will have, ultimately, but I'll duplicate Arjan's link to possible effects of failed application verification.
defaults write
option to add text to the unlock panel? (Just like there is adefaults write
for the login window). Or maybe someone knows how to make the screensaver invoke Fast User Switching instead...? (That would still be a workaround though.) Or how to show the background image while the unlock panel is visible?