Re: Prevent screen saver from starting, but don't prevent computer sleep
Re: Prevent screen saver from starting, but don't prevent computer sleep
- Subject: Re: Prevent screen saver from starting, but don't prevent computer sleep
- From: Sandor Szatmari via Cocoa-dev <email@hidden>
- Date: Sat, 27 Jun 2020 13:31:16 -0400
G,
> On Jun 27, 2020, at 12:47, Gabriel Zachmann via Cocoa-dev
> <email@hidden> wrote:
>
> 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.
Not sure in general, but in a managed host situation this type of system
modification could be disallowed by policy. Even admin users of a managed
system can be barred from changing settings like these as they can affect
security, eg when passwords must be prompted. You wouldn’t want any person to
be able to walk by and quit your app and have access to the user’s files.
Anyway, probably not an issue for the majority of your users, but something to
thing about…
Sandor
>
> 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
>
>
>
>
> _______________________________________________
>
> 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
_______________________________________________
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