Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Does anybody have a way to include contact information on the Mac unlock panel? Something like:

If found, please contact My Name at (555) 555-555 or myname@example.com

So if I were to misplace my laptop, this would be presented when opened.

Unlock after screensaver

I have a business card taped to the bottom, too, but this would be an additional measure.

Bounty for identifying how to either edit the unlock .nib file to add the contact information

share|improve this question
    
Just for the search engines: in 10.6 "To access this computer, you need to enter your password."; in 10.5 "You must authenticate to unlock the screen. Mac OS X requires that you type your password." (So, @Doug, it might actually matter if you're on 10.5 or 10.6.) –  Arjan Sep 23 '09 at 10:50
    
Somebody at Apple did a nice job wordsmithing that. The new one is so much better. –  Doug Harris Sep 23 '09 at 13:58
    
For 10.6, instead of the workarounds in the answers below, maybe someone knows about some defaults write option to add text to the unlock panel? (Just like there is a defaults 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? –  Arjan Sep 25 '09 at 10:49
    
It would be cool to add the feature on Ubuntu that allows for a passerby to "leave a message" for the user :) –  Sable May 20 '10 at 21:54
    
Yeah, that would be cool. –  Doug Harris May 20 '10 at 22:08

5 Answers 5

up vote 3 down vote accepted
+100

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:

enter image description here

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:

enter image description here

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.

share|improve this answer
    
Good find, this will make Doug happy! And I never knew that one could simply use the property list utilities to peek around in those nibs. The only thing I'm wondering about: why would Apple put the translations in the nibs? Seems quite a maintenance nightmare to me. –  Arjan Sep 27 '09 at 9:28
1  
OOOPS, my codesign command was wrong! Using --display does not validate anything; deleting that option even finds my changed icon. I changed the codesign command in my answer; see also superuser.com/questions/47504/… which I hope will clear up things, if answered. Right now, I do NOT know if this is a problem. (And, of course, your answer is still what Doug asked for!) –  Arjan Sep 27 '09 at 14:22
    
Thanks. Updated the answer with that information. –  wfaulk Sep 27 '09 at 15:52
    
Oh, wow, that a very good test you did: Also, if it's too long, it seems to break unlocking altogether; it won't display the unlock window at all. I guess using Xcode one could resize the dialog altogether? (No need to run Xcode as root when temporarily changing the file's permissions.) –  Arjan Sep 27 '09 at 22:18
    
Heh. I was just trying to test the font and copied some lorem ipsum from somewhere. Had to go all the way upstairs to log in remotely and kill loginwindow. :( I hate meatspace. –  wfaulk Sep 27 '09 at 22:30

For 10.6, the only way to change the unlock panel seems to be by changing the nib, like described very well in wfaulk's answer.

So, this answer is only useful for those on 10.5, or for those who want to change the message on the login window (rather than the unlock panel). The login window is also used in Fast User Switching, but not for a password protected screensaver.

For 10.5, it's actually very easy. How to add a text message to login window (after waking up from sleep) on macosxhints.com explains:

You can edit the last [first, AvB] sentence of that dialog by editing the file "loginwindow.strings" located in /System/Library/CoreServices/loginwindow.app/Contents/Resources/English.lproj. You'll need to control-click loginwindow.app to "Show Package Contents" (The ".app" is normally hidden).

The area to edit looks like this:

/********** Screen Lock Password **********/
/* Message for unlocking the screen lock modal dialog */
/* It should not mention anything about the METHOD for authentication */
/* such as entering as password. Instructions regarding the method for */
/* for authentication will be appended by the SecurityAgent */
"Enter your password to unlock the screen."="You must [..] screen.";

The text in blue ["You must authenticate to unlock the screen.", AvB] is what you want to change. Please take care to only work with a copy of the loginwindow application so you can easily restore in case you make a mistake.

Indeed, this works fine on 10.5.8. (Ensure to save as big-endian UTF-16. Log out is needed after making changes, and OS X will always add the text "Mac OS X requires that you type your password" or whatever line is applicable.)

Not so much in 10.6.

The string is still there, but not used as the dialog now only says "To access this computer, you need to enter your password." Boldly adding a line like the following does not work:

"To access this computer, you need to enter your password."="Call me! Doug.";

Using strings or hexdump -C, the text can be found in the (compiled) nib keyedobjects.nib, within /System/Library/CoreServices/loginwindow.app/Contents/Resources/English.lproj/BuiltInAuth.nib/ Creating a brand new file BuiltInAuth.strings with above line does not help. And for other localisations, the compiled nib is different as well:

cd /System/Library/CoreServices/loginwindow.app/Contents/Resources/ 

grep -iR \
  "U moet uw wachtwoord opgeven om toegang te krijgen tot deze computer." *
Binary file Dutch.lproj/BuiltInAuth.nib/keyedobjects.nib matches

Like noted above: see wfaulk's answer to change the texts in the nibs.

For 10.6, one can change the image Security.icns within that same Resources folder. (Tested in 10.6.1. Again, log out is needed after making changes.) Unfortunately, the icon is scaled to fit into its original place and that leaves one very little room to play in:

      Unlock screen with custom item

However, this breaks Code Signing, which might affect firewall settings, and maybe also software update. I don't know if this is really a problem; see more details at If Mac code signing is tampered with, what might fail?

codesign -vvv /System/Library/CoreServices/loginwindow.app

/[..]/loginwindow.app: a sealed resource is missing or invalid
/[..]/Contents/Resources/Security.icns: resource modified

When one is used to manually locking the screen, then in 10.6, a workaround might be to use Fast User Switching. For both 10.5 and 10.6, text is easily added to the login window (which is not the same as the unlock panel):

sudo defaults write /Library/Preferences/com.apple.loginwindow \
  LoginwindowText -string \
  'If found, please contact My Name at (555) 555-555 or myname@example.com'

And, in 10.6, Fast User Switching can easily be added to the Services menu, and be assigned a keyboard shortcut. Still, this would only work when manually locking the computer.

share|improve this answer

You might be better off putting that information on the machine itself (tape a card to the bottom or something). The unlock screen may not be visible to the person who finds it, depending on the last state of the laptop. If the battery died they won't be able to see anything on the screen. Even if they plug it in it might just boot up to the login screen (depending on if it successfully hibernated, which doesn't always happen).

You'd have to put the info in multiple places if you do it in software. It'll be much more reliable to make a "hardware" solution.

share|improve this answer
2  
I've already got a card taped tongue bottom. –  Doug Harris Aug 27 '09 at 23:55
    
I must've typed that last one on my iPhone. Should read "I've already got a card taped to the bottom." –  Doug Harris Sep 22 '09 at 14:09
    
hah. I totally didn't notice the typo until you mentioned that. :) –  Herms Sep 22 '09 at 16:08
    
As you can see, it took me a few weeks to notice as well. –  Doug Harris Sep 23 '09 at 13:59
    
that's the awesomest typo yet on SU :) –  warren Sep 25 '09 at 11:29

Off the top of my head, I think it should be possible to edit the default background of the login screen (it’s in /System/Library/CoreServices/DefaultDesktop.jpg) and add the contact information to it. I think that would work in a pinch.

share|improve this answer
    
Nice idea, but when I lock the screen (via screen saver) the unlock panel has a plain black background -- not the screensaver, not the default desktop. –  Doug Harris Aug 27 '09 at 20:42

Yes, this is definitely doable (that is if we are thinking of the same thing).

You can use VisageLogin to customize a lot of different aspects of the login screen, including the text that displays.

share|improve this answer
    
I'll download this, but it's not clear from the site if it works for screen lock or only for login. 99% of the time that my MacBook is closed, it's locked - not off, not logged out. –  Doug Harris Aug 27 '09 at 23:58
    
Sorry. The program is just for the login screen, not the lock screen. The only way I can think of to customize the lock screen would be to try and find the .nib Interface Builder file and manually change the UI for it (provided you have the Developer Tools) –  David Pearce Aug 28 '09 at 0:19
    
Oh, good point. I used to do that sort of thing back in the NextStep era. I'm only back on a mac in the past year and a half. I've forgotten the little tricks. –  Doug Harris Aug 28 '09 at 2:58
    
My guess is that this in /System/Library/Frameworks/ScreenSaver.framework/Versions/Current/Resources/Scre‌​enSaverEngine.app/Contents/Resources/English.lproj/ScreenSaverEngine.nib but when I try to open it, IB says "Interface Builder cannot open compiled nibs." There are some hacks to get around this, but I don't know if I care enough. –  Doug Harris Sep 21 '09 at 21:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.