TweetFollow Us on Twitter

MacEnterprise: Custom Slide Show Screen Savers

Volume Number: 26
Issue Number: 02
Column Tag: MacEnterprise

MacEnterprise: Custom Slide Show Screen Savers

Leveraging a new Snow Leopard feature for informational displays

By Greg Neagle, MacEnterprise.org

Introduction

In a previous MacEnterprise column, we looked at a new Snow Leopard feature: a screen saver now runs over the LoginWindow when the Mac has been idle for a while. We looked at using MCX and defaults to control which screen saver runs at the LoginWindow, and how long the computer must be idle before it runs. We also discussed why some organizations might want to control the screensaver at the LoginWindow. In instructional labs, students gravitate towards machines that look "alive", and may assume a machine with a dark display is broken, even though it might just be asleep. Also, many organizations want to leave their machines on and awake when no one is logged in so that administrative tasks can be performed in the off-hours. So if you are going to leave these machines on, and their displays active, you might want to have them perform a useful function while they are sitting at the LoginWindow. One possibility is to implement a screen saver that displays news updates or important announcements for your organization, or even something as simple as lab hours and policies.

Making a Slide Show

If you open the Desktop & Screen Saver preference pane in System Preferences, you've probably noticed the option to choose a folder of pictures to use as a screen saver. You may be thinking that all you need to do to create a custom informational display is to install a folder of pictures to be the slides for your informational display then use MCX or defaults to manage com.apple.screensaver preferences to show the pictures in that folder. But there are some problems with this approach:

1. Even after adding the preferences manifests from /System/Library/CoreServices/ManagedClient.app, Workgroup Manager has no options for managing the folder of pictures to use as the screen saver.

2. When using "slide show" screen savers, the default behavior of panning and zooming may not be the best way to present informational slides.

3. The default time each slide is shown (which appears to be ten seconds) might be too short to read the information on each slide; you may want the slides to switch more slowly. There doesn't appear to be any option for controlling the time each slide is displayed.

The first two issues might be solvable by managing additional preferences. For example: it might be possible to get the desired result by managing preferences in com.apple.screensaver.slideshow, and adding additional items to manage in com.apple.screensaver. But in Snow Leopard, the defaults entries for slide show screensavers are more complicated than they were in prior OS releases. I, for one, have not been able to set up a slide show screensaver that shows a custom folder of pictures over the LoginWindow using only MCX management or its equivalent defaults entries in /Library/Preferences.

SlideSavers

As it turns out, there is a fairly straightforward solution to all of these issues. Again, when you've used the Desktop & Screen Saver preference pane in System Preferences, you may have noticed the built-in slide show screensavers—the ones with names like Abstract, Beach, Cosmos, and so on. A visit to /System/Library/Screen Savers shows us that these are another type of bundle. In the Screen Savers folder, the Abstract screen saver is actually called Abstract.slideSaver. If you control-click on Abstract.slideSaver and choose Show Package Contents to open the bundle contents, you'll see the contents are quite simple: a few plist files and a Resources directory containing the pictures to display and some language-localized strings, as shown in Figure 1.


Figure 1 - Abstract.slideSaver contents

So if a slideSaver is a just a folder of pictures with some metadata around it, this suggests it should be very simple to create our own custom slideSaver. And it is.

Start by copying the Abstract slideSaver to /Library/Screen Savers/:

> cd /System/Library/Screen\ Savers/
> cp -R Abstract.slideSaver /Library/Screen\ Savers/

Then rename it:

> cd /Library/Screen\ Savers/
> mv Abstract.slideSaver MyCustom.slideSaver

Now we need to edit some of the metadata. Start with /Library/ScreenSavers/MyCustom.slideSaver/Contents/Info.plist, which initially will look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>CFBundleDevelopmentRegion</key>
   <string>English</string>
   <key>CFBundleGetInfoString</key>
   <string>Abstract screen saver module</string>
   <key>CFBundleIdentifier</key>
   <string>com.apple.screensaver.Abstract</string>
   <key>CFBundleInfoDictionaryVersion</key>
   <string>6.0</string>
   <key>CFBundleName</key>
   <string>Abstract</string>
   <key>CFBundlePackageType</key>
   <string>BNDL</string>
   <key>CFBundleShortVersionString</key>
   <string>1.3</string>
   <key>CFBundleSignature</key>
   <string>????</string>
   <key>CFBundleVersion</key>
   <string>1.3</string>
</dict>
</plist>

Edit the values of CFBundleGetInfoString, CFBundleIdentifier, and CFBundleName to reflect the name of your custom slideSaver. When you are finished, it should look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>CFBundleDevelopmentRegion</key>
   <string>English</string>
   <key>CFBundleGetInfoString</key>
   <string>Custom saver module</string>
   <key>CFBundleIdentifier</key>
   <string>com.mactech.screensaver.MyCustom</string>
   <key>CFBundleInfoDictionaryVersion</key>
   <string>6.0</string>
   <key>CFBundleName</key>
   <string>MyCustom</string>
   <key>CFBundlePackageType</key>
   <string>BNDL</string>
   <key>CFBundleShortVersionString</key>
   <string>1.3</string>
   <key>CFBundleSignature</key>
   <string>????</string>
   <key>CFBundleVersion</key>
   <string>1.3</string>
</dict>
</plist>

Next, edit the localized language strings. On my computer, I have only an English.plist folder inside Contents/Resources. You may have additional languages. For the English language strings, edit English.lproj/InfoPlist.strings, found in /Library/ScreenSavers/MyCustom.slideSaver/

Contents/Resources/. Initially, it will look like this:

"CFBundleName" = "Abstract";

Change the name to match your custom slideSaver's name and save it:

"CFBundleName" = "MyCustom";

Before we go any further, we should test our changes. Open System Preferences, choose the Desktop & Screen Saver preference pane, and you should see MyCustom (or whatever you've named it) in the list of available screen savers. If you select it, you'll see a screen saver identical to the Abstract screen saver - because we haven't yet changed the pictures included in the slideSaver.

The next part is the fun part: replace all the pictures in /Library/ScreenSavers/MyCustom.slideSaver/Contents/Resources/ with your own! For informational signage, one convenient way to generate content for the slideSaver is to use Keynote (or even PowerPoint). Make your slides (and leave off any animation or transitions), then export them as pictures - one picture per slide. If you keep the original Keynote or PowerPoint document, you can revise it in the future, and then re-export the slides as needed.

When creating the content, make sure you consider the aspect ratio of the displays you will be using it on. If you design widescreen content on your laptop, but deploy the custom screensaver on a lab full of desktop machines with 4:3 screens, you may find important content cut off on the sides. Conversely, if you design the content on a 4:3 screen and it gets displayed on a screen with a wide aspect ratio, it may have ugly black bars on the sides or, if the slides are zoomed to fill the display, content is cut off the top and bottom. One approach to deal with these issues is to create the content with a widescreen slide aspect ratio, but keep the important content within the 4:3 center area. This way, the slides display correctly on widescreen displays, and when the sides are cropped on standard aspect ratio displays, nothing important is lost. Experiment and see what works best for you.

In Figure 2, I've created a short slide show in Keynote, and exported it as slides. I then copied those into the Resources folder inside the slideSaver.


Figure 2 - our custom slideSaver with custom slides

Configuring the SlideSaver

If you now test your custom slideSaver, you'll see your slides, but unless you've set different options, the default behavior of panning and zooming may not be the best way to display your slides. Showing the slides in random order may also be not what is wanted. In the Screen Saver preference pane, you can click the Options... button and adjust the behavior to your liking.

But that now presents another problem - since you want something other than the default preferences, you now have to manage an additional set of preferences, since the preferences for slideSavers are not stored in com.apple.screensaver; instead they are stored in com.apple.screensaver.<slide_saver_name>. For our example custom slideSaver, they'd be stored in com.apple.screensaver.MyCustom:

> defaults -currentHost read com.apple.screensaver.MyCustom
{
    Center = 1;
    Crop = 0;
    Crossfade = 0;
    DisplayType = Slides;
    Random = 0;
    Zoom = 1;
}

So we could create our custom slideSaver, deliver it to our all our machines, and then use MCX or defaults to manage com.apple.screensaver to set the LoginWindow screensaver to our custom slideSaver. We could also use MCX or defaults to manage the com.apple.screensaver.customslidesavername preferences to get the desired display behavior. But as you may have guessed, there is an easier way. It turns out that you can include your desired preferences inside the slideSaver bundle.

To specify the "default" defaults for the slideSaver, you need to create a .Settings.plist file in the Contents/Resources directory of the slideSaver:

>cat MyCustom.slideSaver/Contents/Resources/.Settings.plist 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>Center</key>
   <true/>
   <key>Crop</key>
   <false/>
   <key>Crossfade</key>
   <false/>
   <key>DisplayType</key>
   <string>Slides</string>
   <key>Random</key>
   <false/>
   <key>Zoom</key>
   <true/>
</dict>
</plist>

The settings above correspond to the options in Figure 3. Adjust the values to match your preferred options.


Figure 3 - slideSaver options

We have one more problem to solve. The default ten-second time for each slide might be too short for your content - what if you want fifteen or twenty seconds per slide? The GUI options as seen in Figure 3 have no way to specify the slide duration.

Hidden Preference Hunting

It's not uncommon for OS X applications to have hidden preferences - that is, preferences that are not exposed via the GUI. A common way to hunt for hidden preferences is to use strings. This is a UNIX command-line utility that prints all the strings in a binary file, typically an executable. Since OS X defaults are stored in plist files with strings for keys, this is an effective way to find defaults keys that aren't exposed in the GUI.

The slideSaver bundles have no executable code - they are just data for the Pictures Folder.saver, located at /System/Library/Frameworks/ScreenSaver.framework/Resources/Pictures Folder.saver. The Pictures Folder.saver is itself a bundle, with the executable located at Contents/MacOS/Pictures Folder. This is the executable we must run the strings utility against:

> cd /System/Library/Frameworks/ScreenSaver.framework
> cd Resources
> cd Pictures\ Folder.saver/Contents/MacOS
> strings Pictures\ Folder
Thumbs
failed to open directory %s
can't get fsRef for path %s
can't read path %s
can't resolve alias %s
...

On Mac OS X 10.6.2, strings prints 1819 lines of strings from the Pictures Folder executable. That's a lot to look through. But we're looking for something to do with the number of seconds each slide displays, so we can use grep to narrow down the results:

> strings Pictures\ Folder | grep -i seconds
_delaySeconds
setupTransition:delaySeconds:
MosaicTransitionSeconds
MosaicTransitionDelaySeconds
MosaicZoomSeconds
_zoomSeconds
_transitionSeconds
_pauseSeconds

Some of those look promising, but most don't really follow the naming convention for defaults keys, which is "CamelCase", where all words are run together and capitalized, including the first word. The only ones that are in CamelCase are the "Mosaic" ones, and again, those don't seem right. So we try something else:

> strings Pictures\ Folder | grep -i delay
_delaySeconds
setupTransition:delaySeconds:
MosaicTransitionDelaySeconds
performSelector:withObject:afterDelay:
_delayStartTime

Those don't look any more promising. One more variation:

> strings Pictures\ Folder | grep -i time
setAnimationTimeInterval:
_startTime
{?="iterations"l"durations"[30d]"minFrameRate"d"lastPrintedAvg"d"lastDrawTime"@"NSDate"}
_rssStartTime
timeIntervalSinceNow
dateWithTimeIntervalSinceNow:
Times-Italic
dropTime
inertiaTime
_dropTime
_inertiaTime
timeRemainingInDrop
timeIntervalSinceDate:
_delayStartTime
setTimeStyle:
_updateTimer
_fadeTimer
_fadeStartTime
FadeTime
ZoomTime
zoomTime
fadeTime
_bgTimer
@"NSTimer"
_zoomTime
_fadeTime
[3{SlideShowTexGeometry="state"i"startTime"d"endTime"d"nowTime"d"startPt"
{?="x"f"y"f"z"f}"endPt"{?="x"f"y"f"z"f}"nowPt"{?="x"f"y"f"z"f}"imageRect"
{_NSRect="origin"{_NSPoint="x"f"y"f}"size"{_NSSize="width"f"height"f}}
"scaleFactor"f"forward"c"valid"c"path"@"NSString""imageIndex"i}]
_fgFrameRateTime
_bgFrameRateTime
NSTimer
gettimeofday returned -1: %s
dateWithCalendarFormat:timeZone:
timedOut
_startTimeoutTimer
scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:

Ugh. Thirty-five results, but two look promising:

FadeTime
ZoomTime

These are in CamelCase and seem to have something to do with slide timing. We can check the context like so:

> strings Pictures\ Folder | grep -10 ZoomTime

f24@0:4{_NSSize=ff}8{_NSSize=ff}16
scaledImageSizeForImageSize:tileSize:
{_NSSize=ff}24@0:4{_NSSize=ff}8{_NSSize=ff}16
drawAt3DPoint:scale:alpha:
v32@0:4{?=fff}8{_NSSize=ff}20f28
loadAllTiles2
loadAllTiles
loadNextTile
c36@0:4^v8{_NSSize=ff}12{_NSSize=ff}20I28I32
FadeTime
ZoomTime
Random
Crop
Crossfade
plist
.Settings
.Settings.plist
zoomTime
fadeTime
ZoomMode
NO_IMAGES_FULL

When you pass a number to grep, it prints that many lines of context before and after each match. In this case, we see some familiar defaults keys, namely Random, Crop, and Crossfade, so we can be more confident that FadeTime and ZoomTime might be hidden preference keys. You can now also guess how I discovered the .Settings.plist file.

Once you've found some possible undocumented defaults keys, all that is left is to try them out and see. After some experimentation, I determined that ZoomTime was the key I was looking for. To have the slides in your custom slideSaver display for twenty seconds each, your .Settings.plist might look like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>ZoomTime</key>
   <integer>20</integer>
   <key>Center</key>
   <true/>
   <key>Crop</key>
   <false/>
   <key>Crossfade</key>
   <false/>
   <key>DisplayType</key>
   <string>Slides</string>
   <key>Random</key>
   <false/>
   <key>Zoom</key>
   <true/>
</dict>
</plist>

It also turns out that FadeTime controls how long the cross fade takes for each slide. For this custom slideSaver, we've turned off the cross fade, but if you wanted to control it, you could.

Implementation

Now we have a custom slideSaver with our informational slides. We've included a .Settings.plist file in its Resources directory so we can control the slideSaver options without having to manage yet another set of preferences. Now we're ready to implement it on our client machines.

If you read the earlier column where we looked at MCX management of the LoginWindow screensaver preferences, you may remember that we can get virtually the same control by installing a properly configured /Library/Preferences/

com.apple.screensaver.plist file. You can create this file using the defaults command. For example, the following commands would set the idle time to five minutes and set the screensaver to be run over the LoginWindow to our custom slideSaver (watch the line breaks, these are two commands, each all on a single line):

> defaults write /Library/Preferences/com.apple.screensaver 
      loginWindowIdleTime -int 300
> defaults write /Library/Preferences/com.apple.screensaver 
      loginWindowModulePath 
      "/Library/Screen Savers/MyCustom.slideSaver"

So you have a choice: manage the LoginWindow screensaver via MCX, or just install the preference file. Since you are going to have to deliver the files that make up the custom slideSaver to each machine, it might be convenient to just deliver the /Library/Preferences/com.apple.screen

saver.plist file at the same time. Of course, remember that an admin user could modify or remove the preference file once it has been installed. MCX management is a little more temper-proof. The choice is yours.

If you are using a software distribution mechanism that relies on Apple packages, now is the time to package up your custom slideSaver (and maybe the com.apple.screensaver.plist file.) Deliver the custom slideSaver to all your managed machines. Once it has been delivered to each machine, if you've opted to manage the LoginWindow screensaver via MCX, now you can use Workgroup Manager and MCX to manage the LoginWindow screen saver preferences as in Figure 4.


Figure 4 - Screen Saver Loginwindow preference management

Conclusion

That's it! We've created a custom slideSaver by copying and modifying an existing slideSaver. We've customized the slideSaver's options by including a .Settings.plist file for our custom settings. We've done some hunting for hidden preferences to further customize our slideSaver's behavior. Finally, we've used both MCX and defaults to set our custom slideSaver as the screensaver to be displayed over the LoginWindow.

If you manage a lab of Mac OS X machines, you can use the techniques we've explored in this column and the earlier MacEnterprise column to create an informational slideshow that runs over the LoginWindow, putting your machines to useful purpose even when they aren't been used. Outside of instructional labs, enterprise administrators could use these techniques as well, but might also use MCX to manage com.apple.screensaver.ByHost preferences to have the custom slideSaver run over an idle user session as well.


Greg Neagle is a member of the steering committee of the Mac OS X Enterprise Project (macenterprise.org) and is a senior systems engineer at a large animation studio. Greg has been working with the Mac since 1984, and with OS X since its release. He can be reached at gregneagle@mac.com.

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Top Mobile Game Discounts
Every day, we pick out a curated list of the best mobile discounts on the App Store and post them here. This list won't be comprehensive, but it every game on it is recommended. Feel free to check out the coverage we did on them in the links... | Read more »
Price of Glory unleashes its 1.4 Alpha u...
As much as we all probably dislike Maths as a subject, we do have to hand it to geometry for giving us the good old Hexgrid, home of some of the best strategy games. One such example, Price of Glory, has dropped its 1.4 Alpha update, stocked full... | Read more »
The SLC 2025 kicks off this month to cro...
Ever since the Solo Leveling: Arise Championship 2025 was announced, I have been looking forward to it. The promotional clip they released a month or two back showed crowds going absolutely nuts for the previous competitions, so imagine the... | Read more »
Dive into some early Magicpunk fun as Cr...
Excellent news for fans of steampunk and magic; the Precursor Test for Magicpunk MMORPG Crystal of Atlan opens today. This rather fancy way of saying beta test will remain open until March 5th and is available for PC - boo - and Android devices -... | Read more »
Prepare to get your mind melted as Evang...
If you are a fan of sci-fi shooters and incredibly weird, mind-bending anime series, then you are in for a treat, as Goddess of Victory: Nikke is gearing up for its second collaboration with Evangelion. We were also treated to an upcoming... | Read more »
Square Enix gives with one hand and slap...
We have something of a mixed bag coming over from Square Enix HQ today. Two of their mobile games are revelling in life with new events keeping them alive, whilst another has been thrown onto the ever-growing discard pile Square is building. I... | Read more »
Let the world burn as you have some fest...
It is time to leave the world burning once again as you take a much-needed break from that whole “hero” lark and enjoy some celebrations in Genshin Impact. Version 5.4, Moonlight Amidst Dreams, will see you in Inazuma to attend the Mikawa Flower... | Read more »
Full Moon Over the Abyssal Sea lands on...
Aether Gazer has announced its latest major update, and it is one of the loveliest event names I have ever heard. Full Moon Over the Abyssal Sea is an amazing name, and it comes loaded with two side stories, a new S-grade Modifier, and some fancy... | Read more »
Open your own eatery for all the forest...
Very important question; when you read the title Zoo Restaurant, do you also immediately think of running a restaurant in which you cook Zoo animals as the course? I will just assume yes. Anyway, come June 23rd we will all be able to start up our... | Read more »
Crystal of Atlan opens registration for...
Nuverse was prominently featured in the last month for all the wrong reasons with the USA TikTok debacle, but now it is putting all that behind it and preparing for the Crystal of Atlan beta test. Taking place between February 18th and March 5th,... | Read more »

Price Scanner via MacPrices.net

AT&T is offering a 65% discount on the ne...
AT&T is offering the new iPhone 16e for up to 65% off their monthly finance fee with 36-months of service. No trade-in is required. Discount is applied via monthly bill credits over the 36 month... Read more
Use this code to get a free iPhone 13 at Visi...
For a limited time, use code SWEETDEAL to get a free 128GB iPhone 13 Visible, Verizon’s low-cost wireless cell service, Visible. Deal is valid when you purchase the Visible+ annual plan. Free... Read more
M4 Mac minis on sale for $50-$80 off MSRP at...
B&H Photo has M4 Mac minis in stock and on sale right now for $50 to $80 off Apple’s MSRP, each including free 1-2 day shipping to most US addresses: – M4 Mac mini (16GB/256GB): $549, $50 off... Read more
Buy an iPhone 16 at Boost Mobile and get one...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering one year of free Unlimited service with the purchase of any iPhone 16. Purchase the iPhone at standard MSRP, and then choose... Read more
Get an iPhone 15 for only $299 at Boost Mobil...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering the 128GB iPhone 15 for $299.99 including service with their Unlimited Premium plan (50GB of premium data, $60/month), or $20... Read more
Unreal Mobile is offering $100 off any new iP...
Unreal Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering a $100 discount on any new iPhone with service. This includes new iPhone 16 models as well as iPhone 15, 14, 13, and SE... Read more
Apple drops prices on clearance iPhone 14 mod...
With today’s introduction of the new iPhone 16e, Apple has discontinued the iPhone 14, 14 Pro, and SE. In response, Apple has dropped prices on unlocked, Certified Refurbished, iPhone 14 models to a... Read more
B&H has 16-inch M4 Max MacBook Pros on sa...
B&H Photo is offering a $360-$410 discount on new 16-inch MacBook Pros with M4 Max CPUs right now. B&H offers free 1-2 day shipping to most US addresses: – 16″ M4 Max MacBook Pro (36GB/1TB/... Read more
Amazon is offering a $100 discount on the M4...
Amazon has the M4 Pro Mac mini discounted $100 off MSRP right now. Shipping is free. Their price is the lowest currently available for this popular mini: – Mac mini M4 Pro (24GB/512GB): $1299, $100... Read more
B&H continues to offer $150-$220 discount...
B&H Photo has 14-inch M4 MacBook Pros on sale for $150-$220 off MSRP. B&H offers free 1-2 day shipping to most US addresses: – 14″ M4 MacBook Pro (16GB/512GB): $1449, $150 off MSRP – 14″ M4... Read more

Jobs Board

All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.