MacOS Sonoma ScreenSaver

Jack_Turner
New Contributor II

Hey All, 

 

Since moving some of our machines to MacOS Sonoma, our old script which would set company ScreenSavers has stopped working. Has anyone found a solution? i cant seem to get any script to work or able to find one.

3 REPLIES 3

howie_isaacks
Valued Contributor II

I realize my reply does not help get you the solution you need, but I have seen the same problem. With the new way that macOS Sonoma works with screen savers and wallpaper, the script I have been using no longer works. I inherited the script. I didn't write it. I suspect that person who previously had my job got that script either from here or from Github. I have not had the time, or even the feeling of urgency to find a fix yet. Our corporate communications department is really enamored of creating images for screen savers that they want us to distribute across our fleet of Mac and Windows PCs. The question I have always asked is, does anyone really sit and stare at the screen saver to take in all the info that the images convey? The answer is, of course, no. Other people higher placed in my department have been campaigning for stopping this practice and just setting the computer settings to sleep the displays after the computer goes idle. I do this on my personal Mac. I see no need for a screen saver. In the old days, they made sense. Display technology was different and it would sometimes get images "burned in".

I just found this post.

https://forum.iscreensaver.com/t/understanding-the-macos-sonoma-screensaver-plist/718/2 

This may help with creating a script. I may take some time to figure out how to either use this in a script or in a profile. I would prefer a profile with a set location for the screen saver images. That would allow me to create an installer package for the wallpaper images and then just scope a policy with the package to all of the Macs that need the screen saver. Fortunately, it looks like some higher ups have decided that the company wanting to save energy is more important than screen savers.

David_Vazquez
New Contributor

Another solidarity post. Sonoma broke my script as well. My company wants to use a rotating set of images as a screen saver, and I can still of course push the images and even set the folder for the Photos screen saver (using my old script), but I can't actually select the Photos screen saver without touching the Mac. I've even tried watching system events in Console why manually selecting the screen saver to try to reverse engineer the changes in a new script, but nothing I've tried worked.

howie_isaacks
Valued Contributor II

Check this thread.

https://community.jamf.com/t5/jamf-pro/custom-screensavers-in-sonoma/m-p/310092#M269696

My solution was to use a script written by someone on the Mac Admins Slack and another that I modified to work with Sonoma. I took the working script we had for Ventura and made the necessary changes to make it work with Sonoma. That second script is below:

#!/bin/bash

###########################
# Configures key user preferences for screen savers - run as step 2 to
# https://github.com/itjimbo/macOS-Screen-Saver-and-Wallpaper/blob/main/Set%20Screen%20Saver%20and%20Keep%20User's%20Wallpaper.sh
# Screen saver asset path is defined on line 32 but you could probably make this a parameter.
# 2/9/24 | Howie Isaacks
###########################

## Get current user
current_user=$(/usr/sbin/scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/ { print $3 }')
current_user_id=$(/usr/bin/id -u "$current_user")

echo "Current user is "$current_user""
echo "Current user ID is "$current_user_id""

## Set key values for screen saver
echo "Setting key values for screen saver"
sudo -u "$current_user" /usr/bin/defaults -currentHost write com.apple.screensaver CleanExit -string "YES"
sudo -u "$current_user" /usr/bin/defaults -currentHost write com.apple.screensaver PrefsVersion -int 100
sudo -u "$current_user" /usr/bin/defaults -currentHost write com.apple.screensaver showClock -string "NO"
sudo -u "$current_user" /usr/bin/defaults -currentHost write com.apple.screensaver idleTime -int 1200

## Configure screen saver framework
echo "configuring screen saver framework"
sudo -u "$current_user" /usr/bin/defaults -currentHost write com.apple.screensaver moduleDict -dict moduleName -string "iLifeSlideshows" path -string "/System/Library/ExtensionKit/Extensions/iLifeSlideshows.appex" type -int 0

## Additional configuration settings for screen saver framework
echo "configuring screen saver settings"
sudo -u "$current_user" defaults -currentHost write com.apple.screensaver tokenRemovalAction -int 0
echo "setting asset path"
sudo -u "$current_user" defaults -currentHost write com.apple.ScreenSaverPhotoChooser SelectedFolderPath -string "/Library/Screen Savers/Default Collections/ScreenSaver/"
echo "setting shuffle settings"
sudo -u "$current_user" defaults -currentHost write com.apple.ScreenSaverPhotoChooser SelectedSource -int 3
sudo -u "$current_user" defaults -currentHost write com.apple.ScreenSaverPhotoChooser ShufflesPhotos -bool "true"
sudo -u "$current_user" defaults -currentHost write com.apple.ScreenSaver.iLifeSlideShows styleKey -string "Classic"

## Reset prefsd
echo "relaunching prefsd..."
/usr/bin/killall -hup cfprefsd