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 Hat Studios unveils a new gameplay t...
There are a lot of big games coming that you might be excited about, but one of those I am most interested in is Athenian Rhapsody because it looks delightfully silly. The developers behind this project, the rather fancy-sounding Top Hat Studios,... | Read more »
Bound through time on the hunt for sneak...
Have you ever sat down and wondered what would happen if Dr Who and Sherlock Holmes went on an adventure? Well, besides probably being the best mash-up of English fiction, you'd get the Hidden Through Time series, and now Rogueside has announced... | Read more »
The secrets of Penacony might soon come...
Version 2.2 of Honkai: Star Rail is on the horizon and brings the culmination of the Penacony adventure after quite the escalation in the latest story quests. To help you through this new expansion is the introduction of two powerful new... | Read more »
The Legend of Heroes: Trails of Cold Ste...
I adore game series that have connecting lore and stories, which of course means the Legend of Heroes is very dear to me, Trails lore has been building for two decades. Excitedly, the next stage is upon us as Userjoy has announced the upcoming... | Read more »
Go from lowly lizard to wicked Wyvern in...
Do you like questing, and do you like dragons? If not then boy is this not the announcement for you, as Loongcheer Game has unveiled Quest Dragon: Idle Mobile Game. Yes, it is amazing Square Enix hasn’t sued them for copyright infringement, but... | Read more »
Aether Gazer unveils Chapter 16 of its m...
After a bit of maintenance, Aether Gazer has released Chapter 16 of its main storyline, titled Night Parade of the Beasts. This big update brings a new character, a special outfit, some special limited-time events, and, of course, an engaging... | Read more »
Challenge those pesky wyverns to a dance...
After recently having you do battle against your foes by wildly flailing Hello Kitty and friends at them, GungHo Online has whipped out another surprising collaboration for Puzzle & Dragons. It is now time to beat your opponents by cha-cha... | Read more »
Pack a magnifying glass and practice you...
Somehow it has already been a year since Torchlight: Infinite launched, and XD Games is celebrating by blending in what sounds like a truly fantastic new update. Fans of Cthulhu rejoice, as Whispering Mist brings some horror elements, and tests... | Read more »
Summon your guild and prepare for war in...
Netmarble is making some pretty big moves with their latest update for Seven Knights Idle Adventure, with a bunch of interesting additions. Two new heroes enter the battle, there are events and bosses abound, and perhaps most interesting, a huge... | Read more »
Make the passage of time your plaything...
While some of us are still waiting for a chance to get our hands on Ash Prime - yes, don’t remind me I could currently buy him this month I’m barely hanging on - Digital Extremes has announced its next anticipated Prime Form for Warframe. Starting... | Read more »

Price Scanner via MacPrices.net

Save $300 at Apple on 14-inch M3 MacBook Pros...
Apple has 14″ M3 MacBook Pros with 16GB of RAM, Certified Refurbished, available for $270-$300 off MSRP. Each model features a new outer case, shipping is free, and an Apple 1-year warranty is... Read more
Apple continues to offer 14-inch M3 MacBook P...
Apple has 14″ M3 MacBook Pros, Certified Refurbished, available starting at only $1359 and ranging up to $270 off MSRP. Each model features a new outer case, shipping is free, and an Apple 1-year... Read more
Apple AirPods Pro with USB-C return to all-ti...
Amazon has Apple’s AirPods Pro with USB-C in stock and on sale for $179.99 including free shipping. Their price is $70 (28%) off MSRP, and it’s currently the lowest price available for new AirPods... Read more
Apple Magic Keyboards for iPads are on sale f...
Amazon has Apple Magic Keyboards for iPads on sale today for up to $70 off MSRP, shipping included: – Magic Keyboard for 10th-generation Apple iPad: $199, save $50 – Magic Keyboard for 11″ iPad Pro/... Read more
Apple’s 13-inch M2 MacBook Airs return to rec...
Apple retailers have 13″ MacBook Airs with M2 CPUs in stock and on sale this weekend starting at only $849 in Space Gray, Silver, Starlight, and Midnight colors. These are the lowest prices currently... Read more
Best Buy is clearing out iPad Airs for up to...
In advance of next week’s probably release of new and updated iPad Airs, Best Buy has 10.9″ M1 WiFi iPad Airs on record-low sale prices for up to $200 off Apple’s MSRP, starting at $399. Sale prices... Read more
Every version of Apple Pencil is on sale toda...
Best Buy has all Apple Pencils on sale today for $79, ranging up to 39% off MSRP for some models. Sale prices for online orders only, in-store prices may vary. Order online and choose free shipping... Read more
Sunday Sale: Apple Studio Display with Standa...
Amazon has the standard-glass Apple Studio Display on sale for $300 off MSRP for a limited time. Shipping is free: – Studio Display (Standard glass): $1299.97 $300 off MSRP For the latest prices and... Read more
Apple is offering significant discounts on 16...
Apple has a full line of 16″ M3 Pro and M3 Max MacBook Pros available, Certified Refurbished, starting at $2119 and ranging up to $600 off MSRP. Each model features a new outer case, shipping is free... Read more
Apple HomePods on sale for $30-$50 off MSRP t...
Best Buy is offering a $30-$50 discount on Apple HomePods this weekend on their online store. The HomePod mini is on sale for $69.99, $30 off MSRP, while Best Buy has the full-size HomePod on sale... Read more

Jobs Board

*Apple* App Developer - Datrose (United Stat...
…year experiencein programming and have computer knowledge with SWIFT. Job Responsibilites: Apple App Developer is expected to support essential tasks for the RxASL Read more
Omnichannel Associate - *Apple* Blossom Mal...
Omnichannel Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
*Apple* Software Engineer - HP Inc. (United...
…Mobile, Windows and Mac applications. We are seeking a high energy Senior Apple mobile engineer who can lead and drive application development while also enabling Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.