Can we no longer script screen savers in Sonoma?

I would like to know if I am the only one seeing this, but since upgrading to Sonoma, I can no longer control screen savers with AppleScript or Terminal.

This used to work:

tell application "System Events"
	start current screen saver
end tell

and now has no effect. Moreover, this used to work:

tell application "System Events"
	set current screen saver to screen saver "Drift"
end tell

and now results in this error:

System Events got an error: Can’t set screen saver “Drift” to screen saver “Drift”.

If I try to set it to a third-party screensaver:

tell application "System Events"
	set current screen saver to screen saver "Hexadrop"
end tell

…it fails silently, without any error. (Hexadrop is one of the savers in the wonderful XScreenSaver.)

Is anyone else able to replicate any of this? I need a sanity check before I submit feedback to Apple.

By the way, I have also tried using defaults write in Terminal:

defaults -currentHost write com.apple.screensaver moduleDict -dict moduleName -string 'Hexadrop' path -string '/System/Library/Screen Savers/Hexadrop.saver' type 0
and then

killall cfprefsd
and that used to work, too, and no longer works for me. The plist changes, but it has no effect whatsoever on which screen saver actually runs.

Answering my own question: seems like I’m not the only one. I submitted feedback to Apple. Sigh! Hope they fix this.

Hope this gets resolved for you. Just curious, what is the use case for this?

OK, don’t laugh. Or go ahead and laugh since I can’t hear you over the internet! :joy: I am a hoarder of pretty things and a control freak. I have a small apartment, and I hang out in the living room with my iMac. I have no TV. I have lots of screen savers, mostly from XScreenSaver. I want to rotate through them on a daily basis so I can enjoy them all! (I don’t like the built-in Random saver because I can’t omit system savers I don’t like; there used to be a third party RandomExtra for this but it doesn’t work on Apple Silicon Macs.) I was using AppleScript and a Launch Agent to do this. I just figured it all out a few months ago and was loving it, and then Sonoma broke it. I always want to run the latest macOS so no way will I downgrade. So, I submitted Apple Feedback, sigh, and will hope for the best.

Meanwhile I will try some…gasp…GUI scripting!

Plus, I have not learned JavaScript, but I adore even the process of struggling and hopefully succeeding with AppleScript. I find it addictive.

That’s my story, morning glory! Hope you’re not sorry you asked!

1 Like

Yes, it looks pretty grim in Sonoma.

Reading current screen saver has been dodgy for years (frequently returning screen saver "").

But in Sonoma, it appears then

tell app "System Events" to screen savers

returns only two on my Mac (Random and FloatingMessage), and neither of them appear to want to honour the start message.

Definitely worth reporting to Apple, though given the bugs in reading screen savers has been around for several versions I don’t know how much of a priority this will be.

Haha thanks for sharing :slight_smile: It’s always interesting to hear about automation use cases, that’s why we’re here!

Since upgrading to Somona, I have been automating the start of my screensaver with a Shortcut, which I trigger via Keyboard Maestro.

I don’t see a way to choose which screensaver is started, but it works for my needs. Sharing this in case anyone else stumbles across this thread.