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

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 »
If you can find it and fit through the d...
The holy trinity of amazing company names have come together, to release their equally amazing and adorable mobile game, Hamster Inn. Published by HyperBeard Games, and co-developed by Mum Not Proud and Little Sasquatch Studios, it's time to... | Read more »
Amikin Survival opens for pre-orders on...
Join me on the wonderful trip down the inspiration rabbit hole; much as Palworld seemingly “borrowed” many aspects from the hit Pokemon franchise, it is time for the heavily armed animal survival to also spawn some illegitimate children as Helio... | Read more »
PUBG Mobile teams up with global phenome...
Since launching in 2019, SpyxFamily has exploded to damn near catastrophic popularity, so it was only a matter of time before a mobile game snapped up a collaboration. Enter PUBG Mobile. Until May 12th, players will be able to collect a host of... | Read more »
Embark into the frozen tundra of certain...
Chucklefish, developers of hit action-adventure sandbox game Starbound and owner of one of the cutest logos in gaming, has released their roguelike deck-builder Wildfrost. Created alongside developers Gaziter and Deadpan Games, Wildfrost will... | Read more »
MoreFun Studios has announced Season 4,...
Tension has escalated in the ever-volatile world of Arena Breakout, as your old pal Randall Fisher and bosses Fred and Perrero continue to lob insults and explosives at each other, bringing us to a new phase of warfare. Season 4, Into The Fog of... | Read more »
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 below... | Read more »
Marvel Future Fight celebrates nine year...
Announced alongside an advertising image I can only assume was aimed squarely at myself with the prominent Deadpool and Odin featured on it, Netmarble has revealed their celebrations for the 9th anniversary of Marvel Future Fight. The Countdown... | Read more »
HoYoFair 2024 prepares to showcase over...
To say Genshin Impact took the world by storm when it was released would be an understatement. However, I think the most surprising part of the launch was just how much further it went than gaming. There have been concerts, art shows, massive... | Read more »

Price Scanner via MacPrices.net

Apple Watch Ultra 2 now available at Apple fo...
Apple has, for the first time, begun offering Certified Refurbished Apple Watch Ultra 2 models in their online store for $679, or $120 off MSRP. Each Watch includes Apple’s standard one-year warranty... Read more
AT&T has the iPhone 14 on sale for only $...
AT&T has the 128GB Apple iPhone 14 available for only $5.99 per month for new and existing customers when you activate unlimited service and use AT&T’s 36 month installment plan. The fine... Read more
Amazon is offering a $100 discount on every M...
Amazon is offering a $100 instant discount on each configuration of Apple’s new 13″ M3 MacBook Air, in Midnight, this weekend. These are the lowest prices currently available for new 13″ M3 MacBook... Read more
You can save $300-$480 on a 14-inch M3 Pro/Ma...
Apple has 14″ M3 Pro and M3 Max MacBook Pros in stock today and available, Certified Refurbished, starting at $1699 and ranging up to $480 off MSRP. Each model features a new outer case, shipping is... Read more
24-inch M1 iMacs available at Apple starting...
Apple has clearance M1 iMacs available in their Certified Refurbished store starting at $1049 and ranging up to $300 off original MSRP. Each iMac is in like-new condition and comes with Apple’s... Read more
Walmart continues to offer $699 13-inch M1 Ma...
Walmart continues to offer new Apple 13″ M1 MacBook Airs (8GB RAM, 256GB SSD) online for $699, $300 off original MSRP, in Space Gray, Silver, and Gold colors. These are new MacBook for sale by... Read more
B&H has 13-inch M2 MacBook Airs with 16GB...
B&H Photo has 13″ MacBook Airs with M2 CPUs, 16GB of memory, and 256GB of storage in stock and on sale for $1099, $100 off Apple’s MSRP for this configuration. Free 1-2 day delivery is available... Read more
14-inch M3 MacBook Pro with 16GB of RAM avail...
Apple has the 14″ M3 MacBook Pro with 16GB of RAM and 1TB of storage, Certified Refurbished, available for $300 off MSRP. Each MacBook Pro features a new outer case, shipping is free, and an Apple 1-... Read more
Apple M2 Mac minis on sale for up to $150 off...
Amazon has Apple’s M2-powered Mac minis in stock and on sale for $100-$150 off MSRP, each including free delivery: – Mac mini M2/256GB SSD: $499, save $100 – Mac mini M2/512GB SSD: $699, save $100 –... Read more
Amazon is offering a $200 discount on 14-inch...
Amazon has 14-inch M3 MacBook Pros in stock and on sale for $200 off MSRP. Shipping is free. Note that Amazon’s stock tends to come and go: – 14″ M3 MacBook Pro (8GB RAM/512GB SSD): $1399.99, $200... Read more

Jobs Board

Sublease Associate Optometrist- *Apple* Val...
Sublease Associate Optometrist- Apple Valley, CA- Target Optical Date: Apr 20, 2024 Brand: Target Optical Location: Apple Valley, CA, US, 92307 **Requisition Read more
*Apple* Systems Administrator - JAMF - Syste...
Title: Apple Systems Administrator - JAMF ALTA is supporting a direct hire opportunity. This position is 100% Onsite for initial 3-6 months and then remote 1-2 Read more
Relationship Banker - *Apple* Valley Financ...
Relationship Banker - Apple Valley Financial Center APPLE VALLEY, Minnesota **Job Description:** At Bank of America, we are guided by a common purpose to help Read more
IN6728 Optometrist- *Apple* Valley, CA- Tar...
Date: Apr 9, 2024 Brand: Target Optical Location: Apple Valley, CA, US, 92308 **Requisition ID:** 824398 At Target Optical, we help people see and look great - and Read more
Medical Assistant - Orthopedics *Apple* Hil...
Medical Assistant - Orthopedics Apple Hill York Location: WellSpan Medical Group, York, PA Schedule: Full Time Sign-On Bonus Eligible Remote/Hybrid Regular Apply Now Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.