Prevent screen saver from starting, but don't prevent computer sleep
Prevent screen saver from starting, but don't prevent computer sleep
- Subject: Prevent screen saver from starting, but don't prevent computer sleep
- From: Gabriel Zachmann via Cocoa-dev <email@hidden>
- Date: Sat, 27 Jun 2020 18:46:46 +0200
Does anyone know how to programmatically disable macOS from launching the
screen saver on macOS?
I would like to do that in one of my apps.
Note that I do NOT want to disable screen sleep, nor system sleep.
I just want to set the idle time to "Never" , which you would do manually by
going
to System Preferences / Desktop & Screensaver / Start after ...
Basically, what I'd like to do in my app is what I can do using this on the
command line:
defaults -currentHost write com.apple.screensaver idleTime
but I want to do it in my app.
And, of course, I'd like to restore the former setting when my app quits.
My app does not use a lot of compute resources, and it is perfectly fine if and
when the Mac goes to sleep after the idle time set in System Preferences /
Energy Saver / Turn display off after ...
I googled a lot , but I only found hints at using the function
IOPMAssertionCreateWithName(); however, this does not seem to provide an option
for the screen saver.
It seems to me it's just useful to turn off computer sleep.
Also, I found the tool caffeinate, but, again, this seems to me the wrong
utility, because it is all about computer sleep, too.
Any ideas or suggestions would be highly appreciated.
Best regards, Gabriel
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden