G,

> On Jun 27, 2020, at 12:47, Gabriel Zachmann via Cocoa-dev 
> <cocoa-dev@lists.apple.com> 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 (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/admin.szatmari.net%40gmail.com
> 
> This email sent to admin.szatmari....@gmail.com
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to