Wednesday, March 13, 2013

OS X Mountain Lion Screensaver at the Loginwindow


Update (03/05/2015): Here's an Apple Article on the process "https://support.apple.com/en-us/HT202223"

With the release of OS X Mountain Lion (10.8), Apple discontinued supporting custom slidesavers over the loginwindow. Prevously, on OS X Lion, we used an existing slidesaver and modified it to fit our needs as document here: http://www.mactech.com/articles/mactech/Vol.26/26.02/2602MacEnterprise-CustomSlideShowScreenSavers/index.html

Moving ahead with Mountain Lion requires that we take another look at how we configure the loginwindow screensaver. If you're not interested in doing things using the Apple way, you may like the prepackaged solution provided by University of Utah called "10.5 Logout Saver Screen Preserver": http://www.macos.utah.edu/documentation/system_deployment/xhooks.html

If you're still interested a way to use a folder of images as a screensaver for OS X Mountain Lion and you don't want to install extra XHooks stuff, keep reading...

The basic crux of the issue is that there is no GUI for configuring the loginwindow screensaver to use a folder of images. In fact, there isn't any documentation from Apple, that I can find, to configure the loginwindow screensaver. To configure the screensaver we'll have to use the System Preferences GUI and the terminal, so lets get started!

The first step involves configuring the screensaver inside a user account. This is the simplest of the steps and as such I won't go into much detail. You open the Screen Saver preference pane and select a folder of images to use. That's it, just remember to set the users screensaver back to whatever you would like it to be when you're done.

Now that you've selected the folder, two new files have been created for your user. These two files, named com.apple.ScreenSaverPhotoChooser.GUID.plist & com.apple.ScreenSaver.iLifeSlideShows.GUID.plist (Where GUID is your machines ByHost identifier), hold settings that configure the "iLifeSlideshows.saver". The "iLifeSlideshows.saver" ends up being the replacement to your custom slidesaver from the previous OS. Instead of the system using your slidesaver, it uses the iLifeSlideshows.saver and looks for the aforementioned preference files to determine which folder of images should be shown. The System Preferences writes these preference files to /Users/username/Library/Preferences/ByHost/. Find them and copy them to /Library/Preferences now, I'll wait here.

So, now that we've got those two files moved to /Library/Preferences, you should rename them to remove the ByHost GUID. You will end up with file names /Library/Preferences/com.apple.ScreenSaver.iLifeSlideShows.plist & /Library/Preferences/com.apple.ScreenSaverPhotoChooser.plist. Lets take a look at these and modify them to our needs. 

To view the files we can use the defaults command. In the Terminal.app type this:
defaults read /Library/Preferences/com.apple.ScreenSaverPhotoChooser.plist
defaults read /Library/Preferences/com.apple.ScreenSaver.iLifeSlideShows.plist 
 Our first file "com.apple.ScreenSaverPhotoChooser.plist" shows this:

{
    CustomFolderDict =     {
        identifier = "/Library/Preferences/Slides/edu.psu.slides";
        name = "edu.psu.slides";
    };
    LastViewedPhotoPath = "";
    SelectedFolderPath = "/Library/Preferences/Slides/edu.psu.slides";
    SelectedSource = 4;
    ShufflesPhotos = 1;
}
We can see that the preference file has the directory of images that we set in System Preferences. We can also see a few other keys are set. If you want to change the path to the slides, you could do so by editing the SelectedFolderPath and identifier under the CustomFolderDict. Hopefully we've got those set correctly and can move on. In my testing, I found that the SelectedSource key and CustomFolderDict were unnecessary. LastViewedPhotoPath is auto generated, so really the only keys needed are SelectedFolderPath and ShufflesPhotos. Your milage may vary.


The second file "com.apple.ScreenSaver.iLifeSlideShows.plist" shows this:
{
    spansScreensKey = 0;
    styleKey = Classic;
}
The spansScreensKey, I assume, tells the screensaver to show on multiple screens. I've not yet tested this. The styleKey seems to be the way in which the photos appear. One of the alternate styleKeys is "Flipup". I'd like to collect more here, eventually.

Now that we've modified the two files from our user account, we need to tell the system to use the iLifeSlideshows.saver at the loginwindow, as well as how long to wait before doing so.
Check to see if you've already got a "com.apple.screensaver.plist" with this command:
defaults read /Library/Preferences/com.apple.screensaver.plist
Chances are you've not got one. That's fine, we can make one very easily. To configure the system to use the "iLifeSlideshows.saver", which will show our folder of images, we can use this defaults command:
defaults write /Library/Preferences/com.apple.screensaver.plist loginWindowModulePath "/System/Library/Frameworks/ScreenSaver.framework/Resources/iLifeSlideshows.saver"
Careful of line breaks when copying and pasting, check before you hit enter!

Once we've got the correct screensaver chosen, we need to tell the system how long to wait before activating the screensaver over an idle logininwindow. Use this command with the number of seconds to wait:
defaults write /Library/Preferences/com.apple.screensaver.plist loginWindowIdleTime 60
Hopefully it makes sense to you that this would set the loginwindow to show the screensaver after 1 minute. 

Now you can restart your machine and your folder of pictures should appear over the loginwindow after a minute of being idle! Try packaging the files and picture folder for making the deployment easier in the future.

TL;DR

Enable screensaver with these three preference files and a folder of images at /Library/Preferences/imagefolder/:

File: /Library/Preferences/com.apple.screensaver.plist
Contents:
{
    loginWindowIdleTime = 4;
    loginWindowModulePath = "/System/Library/Frameworks/ScreenSaver.framework/Resources/iLifeSlideshows.saver";
}

File: /Library/Preferences/com.apple.ScreenSaverPhotoChooser.plist
Contents:
{
    SelectedFolderPath = "/Library/Preferences/imagefolder";
    ShufflesPhotos = 1;
}

File: /Library/Preferences/com.apple.ScreenSaver.iLifeSlideShows.plist
Contents:
{
    spansScreensKey = 0;
    styleKey = Flipup;
}

NOTES:

Different StyleKeys:
  • Classic - Images appear centered
  • Flipup - Images flip into place in front of previous pictures

10 comments:

winterh said...

SelectedSource = 4;

In file com.apple.ScreenSaverPhotoChooser.plist

Looks like this might be the number of seconds before it switches to the next pic.

winterh said...

I'm having trouble testing/verifying my previous comment, as I can't keep the login screensaver in the source directory -- it keep changing to the NatGeo one. :(

Unknown said...

Great write up, I was actually needing to update my screensaver settings for 10.8 that I use in labs. This worked great.

Azadi said...

These are the different slideshow styles supported on 10.8:

Flipup
Floating
Reflections
Origami
ShiftingTiles
SlidngPanels
PhotoMobile
HolidayMobile
Photowall
Snapshots
VintagePrints
Scrapbook
KenBurns
Classic

These all correspond to the slideshow styles you can choose in System Preferences.

I will check which ones are supported on 10.7 later today and post here.

Azadi

Anonymous said...

Cool blog you got here and thank you for the valuable information. This is truly a great read for me and definitely be back to read some more.

www.n8fan.net

blessed-doha said...

I am in a situation where i need to deploy a simple screen saver company wide mostly jpegs.

I have followed the information on this blog but can't get it to work.

I am putting by the way the plists mentioned here to mcx and have pushed it through the clients. These plists stays at /Library/Managed Preferences

For some odd reason the screensaver still gets to the default one (flurry).

philcebutv@gmail.com said...

I am in a situation where I need to deploy a company wide screensaver and I am trying to pushed this through mcx.

These plist without the gUID resides on /Library/Managed Preferences but for some reason it does not work. It keeps on defaulting to flurry screensaver.

Does the plist needs to be on /Library/Preferences or on users preferences byhost?

Rusty Myers said...

philcebutv@gmail.com, I put my preferences in the system wide context of /Library/Prefs/. If you're deploying the settings via MCX, do you have the images that should show placed on the machine?

philcebutv@gmail.com said...

Rusty. I got it partially working. For some reason it does not play my images. I have put my images on /Library/Screen Savers/myfolders and I have added as well a path entry pointing to the above location in my com.apple.ScreenSaverPhotoChooser.plist

all my plist is placed under /Library/Managed Preferences

I have added as well the path to /System/Library/Frameworks/ScreenSaver.framework/Resources/iLifeSlideshows.saver in loginwindowmodulepath on com.apple.screensaver

However the images playing on the login screen are the default collection images - 1-National Geographic

changing the images to my custom images on the 1-National Geographic folder works (screensaver kicks in with my custom images) but do not want to do this.

Is there a way as well to make the slide Crossfade and stretch on the whole screen?

Rusty Myers said...

philcebutv@gmail.com, I've not tried this with MCX, so there may be something there that's causing it to fail.

I've re-used the same plists on Mavericks and the screen saver is working as expected.

Maybe post your plist files so we can compare them?
Are permissions correct on your images folder (same as National Geographic's)? I'm using 755 for the folder and 644 for the images.

Not 100% sure on cross fade and stretch. Check previous comment for slideshow styles.