Hack the Login Window
If you download the latest copy of Cocktail you’ll note that it allows you to change the text of the login window. A nifty feature to be sure (in the olden days you had to invoke the command line, summon pico and muck about to get everything just right) but just not enough for those who want a truly customized login Window (and who wouldn’t). With that in mind I thought it would be nifty to run through a method to change the picture the login window displays. One caveat: I’m sure there are easier/better ways to do this, but this is the way I came up with. Ready? Let’s go! Well, not just yet. If you want to play along you’ll have to install Xcode. It came with your Mac, so no out of pocket expense.
First use Cocktail to change the login window text (I used “Do not seek the treasure”) and decide if you’te satisfied. Somehow, a custom banner just doesn’t seem like enough to me. You’re using a Mac so you probably appreciate the visual aspect of Mac OS X. So let’s take the login window to the next level and add some visual customization. For this, you’ll need to modify the LoginWindowUI.nib file. Before you get around to modifying the file that tells Mac OS X what images to display at login you’ll want a custom image for that file to actually use. A little pre-hack homework is in order. Create a 90 × 90 image (.tif format naturally) that you would like displayed in the Login Window and store it on the Desktop. The file you just created needs to be stored in a specific folder for the file you are going to modify to make use of said image so it is off to the Terminal. Type the following:
cp newfile.tif /System/Library/CoreServices/SecurityAgentPlugins/loginwindow.bundle/Contents/Resources/English.lproj
Where newfile.tif is the file you just created and everything that follows is the destination for your newly created image. Now back to the hack. First, you need to locate the necessary file. The path is as follows:
If you’ve followed that path correctly you won’t see the file we are looking for. You will see some .bundle files that resemble little Lego blocks. Don’t worry, everything is as expected. Control-click on loginwindow.bundle and choose “Show Package Contents.” From this point adhere to the following path:
Now make a backup copy of this file and place it somewhere it can remain untouched by hacking hands. (*Not strictly necessary because when you save changes to a .nib file the original file is preserved as
~.nib. Still it is a good precaution.) Create another copy to work on (Mac OS X won’t allow you work directly on the file when it resides in the English.lproj folder). Now double-click on the working copy of LoginWindowUI.nib and Interface Builder will open the file (hope you’ve installed Xcode). You’ll see a three windows, as shown in below:
The many windowed Interface Builder
In Interface Builder, select Tools → Show Inspector.
Your pal the inspector
Click on the spot where the Apple logo resides; you should see the Inspector window shown above (if not make sure Inspector is set to “Attributes”). The small bit of text that says “applelogo” is all you need to change.
Note the text box next to the “Image” title it is currently set to “applelogo.” If you change “applelogo” to some other name of a .tif file in the Resources folder, the Login Window will display that image instead. For example, if you changed it to contH.tiff, you would see a continue button instead of the Apple Logo.
Type in a name for the image file you want to use, in this exercise the filename is “newfile.” Go to File → Save to save the file, and then quit Interface Builder. Now drag your hacked copy of LoginWindowUI.nib back to the English.lproj folder and replace the now outdated file. When you do, you’re told you are not allowed to do that, but remember that this is your computer, so all you need to do is hit the Authenticate button and type in your password. The system bows to your will and saves the nib file to the English.lproj folder, just as you wanted (er, demanded!).
Now log out of your account and (payoff time) when you log back in you’ll see this:
No other Mac in the world has a Login Window like this!
The dirtier way to do this is by simply replacing the applelogo.tif file with a .tif of your own. Sure, that method works just fine, but you wouldn’t have learned anything about Interface Builder and you will likely find the hacked file showing up at unexpected times.
As you have guessed by now you can use this methodology to completely revamp the Login Window. I think I’ll leave mine with just the additional text and cousin Pete looking on, but you can use Interface Builder to change just about any visual element that is displayed when the Login Window is shown.