Re: Prevent screen saver from starting, but don't prevent computer sleep

2020-06-29 Thread Gabriel Zachmann via Cocoa-dev
> 
> Otherwise, if sandboxing, refer to this discussion.
> https://stackoverflow.com/questions/21956946/authenticate-user-objective-c-cocoa-sandboxing
>  
> 

Thanks a lot for the link.

After carefully reading the docs, it seems to me this will not work in 
sandboxed apps.

So, is there a simple API that would allow me to 
1. ask the user to authorize herself/himself;
note: I don't care for user name  / password
2. on return, tells me whether or not the user provided the correct credentials 
.
Before the user has authenticated, he/she should not be able to anything else 
in my app (shouldn't be able to quit, or make any other user interaction).

It should work in a sandboxed app.


Thanks a lot in advance for all kinds of hints and insights.
Best regards, Gabriel








smime.p7s
Description: S/MIME cryptographic signature
___

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


Re: Prevent screen saver from starting, but don't prevent computer sleep

2020-06-29 Thread Sandor Szatmari via Cocoa-dev
Gabriel,

> On Jun 29, 2020, at 07:04, Gabriel Zachmann  wrote:
> 
> 
>> I was hoping to convey to the OP that the goals of this question might have 
>> unintended consequences.
> 
> 
> I realize there might be security concerns with what I am trying to do.
> 
> Is there a way to lock the screen such that the user has to provide their 
> password to unlock it,
> and still have my app run fullscreen on the display?
> (similar to what happens when the screensaver is running)

I can’t remember if you are Sandboxing or not… but, if not, look at 
https://developer.apple.com/documentation/security/authorization_services

Otherwise, if sandboxing, refer to this discussion.
https://stackoverflow.com/questions/21956946/authenticate-user-objective-c-cocoa-sandboxing
> 
> 
> 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/archive%40mail-archive.com

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


Re: Prevent screen saver from starting, but don't prevent computer sleep

2020-06-29 Thread Gabriel Zachmann via Cocoa-dev

> I was hoping to convey to the OP that the goals of this question might have 
> unintended consequences.


I realize there might be security concerns with what I am trying to do.

Is there a way to lock the screen such that the user has to provide their 
password to unlock it,
and still have my app run fullscreen on the display?
(similar to what happens when the screensaver is running)


Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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


Re: Prevent screen saver from starting, but don't prevent computer sleep

2020-06-29 Thread Sandor Szatmari via Cocoa-dev


> On Jun 29, 2020, at 02:46, じょいすじょん  wrote:
> 
> 
> 
>>> On Jun 29, 2020, at 15:24, Sandor Szatmari  
>>> wrote:
>>> 
>>> 
>>> 
 On Jun 28, 2020, at 22:29, じょいすじょん via Cocoa-dev 
  wrote:
>>> 
>>> One way to do this is with the command line tool:
>>> caffeinate
>>> 
>>> You could run a background task that starts it with something like 
>>> caffeinate -dimsu
>>> 
>>> You can probably also find its source code on opensource.apple.com to 
>>> understand what it does and how.
>>> 
>>> Like here is a version:
>>> 
>>> https://opensource.apple.com/source/PowerManagement/PowerManagement-637.20.2/caffeinate/caffeinate.c.auto.html
>>> 
>>> You certainly still want a user to approve things.
>> 
>> I would say that if the user has the checkbox selected in system preferences 
>> that ties sleep/screensaver to security (prompt for password on 
>> sleep/screensaver activation) they have already answered this question.  In 
>> this situation any app that calls caffeinate in the background (or uses an 
>> API) to circumvent this security settings without informing the user should 
>> be considered dubious at best and perhaps even malware.  In effect this is 
>> disabling that security choice.  If the user has not selected this setting 
>> in system prefs then there is no issue preventing screensaver from 
>> activating.  I’d recommend this criteria for the basis of whether to 
>> interfere with normal system operations.
>> 
>> Sandor
> 
> Nobody said circumvent anything.
I know you didn’t say circumventing.  But, what is being asked is how to 
prevent screen saver from kicking in.
> I believe a user would have to authorize an NSTask or similar usage anyway, 
> unless they have disabled SIP.
Yes. This would inform the user.  That would be nice.
> I just provided reference to a tool that is already built and bundled that 
> does this (less code) and the source to that tool (inspiration for other 
> code).
Yes, agreed…
> I will not make any claims as to how that works with sandboxing. I 
> whole-heartedly expect and want any such functionality to be made clear to 
> users.
Yes, you did make that clear.  I was hoping to convey to the OP that the goals 
of this question might have unintended consequences.
> That said, it is easy to understand loads of legitimate use-cases for this.
Yea, agreed…

Sandor
> 
___

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


Re: Prevent screen saver from starting, but don't prevent computer sleep

2020-06-29 Thread Gabriel Zachmann via Cocoa-dev
Thanks!
That seems rather what I need.


Now, is there a way to check the user's password before my app quits or goes 
out of full-screen mode?


Best regards, Gabriel





smime.p7s
Description: S/MIME cryptographic signature
___

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


Re: Prevent screen saver from starting, but don't prevent computer sleep

2020-06-29 Thread John Joyce via Cocoa-dev


> 
> On Jun 29, 2020, at 10:53, Graham Cox via Cocoa-dev 
>  wrote:
> 
> In the “old days”, your app could periodically call UpdateSystemActivity( 
> UsrActivity ) to prevent the screensaver kicking in. This has been deprecated 
> since 10.8, but the header for that function says it can be replaced by 
> IOPMAssertionCreateWithName(). I haven’t looked at that in detail or used it 
> myself, but one of the defines for that function is 
> ‘kIOPMAssertionTypePreventUserIdleDisplaySleep’, which appears to do the same 
> thing as the old UpdateSystemActivity() call.
> 
> Apologies if you already discussed this and rejected it for some reason, but 
> otherwise, it may be worth checking out.
> 
> —Graham

I think those assertions are called in caffeinate source ;)

___

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


Re: Prevent screen saver from starting, but don't prevent computer sleep

2020-06-29 Thread Graham Cox via Cocoa-dev
Then look at some of the other options in that API, e.g. 
IOPMAssertionDeclareUserActivity

AFACS, this is the supported way to do the kinds of things you want, of it can 
be done at all.


> On 29 Jun 2020, at 4:51 pm, Gabriel Zachmann  wrote:
> 
>> but the header for that function says it can be replaced by 
>> IOPMAssertionCreateWithName(). I haven’t looked at that in detail or used it 
>> myself, but one of the defines for that function is 
>> ‘kIOPMAssertionTypePreventUserIdleDisplaySleep’, which appears to do the 
>> same thing as the old
> 
> Would that also prevent the compute from going to sleep?
> 
> Also, I do not want to prevent the display from going to sleep.
> I want to prevent the screen saver to kick in.
> 
> 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/archive%40mail-archive.com

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


Re: Prevent screen saver from starting, but don't prevent computer sleep

2020-06-29 Thread Gabriel Zachmann via Cocoa-dev
Thanks for the hint.

Can caffeinate be run such that it prevents ONLY the screensaver from kicking 
in,
but does NOT prevent the system from sleeping?
(I could not find that option in the man page.)

Best regards, Gabriel



> On 29. Jun 2020, at 04:28, じょいすじょん  wrote:
> 
> One way to do this is with the command line tool:
> caffeinate
> 
> You could run a background task that starts it with something like 
> caffeinate -dimsu
> 
> You can probably also find its source code on opensource.apple.com to 
> understand what it does and how.
> 
> Like here is a version:
> 
> https://opensource.apple.com/source/PowerManagement/PowerManagement-637.20.2/caffeinate/caffeinate.c.auto.html
>  
> 
> 
> You certainly still want a user to approve things.
> 
> 



smime.p7s
Description: S/MIME cryptographic signature
___

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


Re: Prevent screen saver from starting, but don't prevent computer sleep

2020-06-29 Thread Gabriel Zachmann via Cocoa-dev
> but the header for that function says it can be replaced by 
> IOPMAssertionCreateWithName(). I haven’t looked at that in detail or used it 
> myself, but one of the defines for that function is 
> ‘kIOPMAssertionTypePreventUserIdleDisplaySleep’, which appears to do the same 
> thing as the old

Would that also prevent the compute from going to sleep?

Also, I do not want to prevent the display from going to sleep.
I want to prevent the screen saver to kick in.

Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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


Re: Prevent screen saver from starting, but don't prevent computer sleep

2020-06-29 Thread じょいすじょん via Cocoa-dev


> On Jun 29, 2020, at 15:24, Sandor Szatmari  
> wrote:
> 
> 
> 
>> On Jun 28, 2020, at 22:29, じょいすじょん via Cocoa-dev  
>> wrote:
>> 
>> One way to do this is with the command line tool:
>> caffeinate
>> 
>> You could run a background task that starts it with something like 
>> caffeinate -dimsu
>> 
>> You can probably also find its source code on opensource.apple.com to 
>> understand what it does and how.
>> 
>> Like here is a version:
>> 
>> https://opensource.apple.com/source/PowerManagement/PowerManagement-637.20.2/caffeinate/caffeinate.c.auto.html
>> 
>> You certainly still want a user to approve things.
> 
> I would say that if the user has the checkbox selected in system preferences 
> that ties sleep/screensaver to security (prompt for password on 
> sleep/screensaver activation) they have already answered this question.  In 
> this situation any app that calls caffeinate in the background (or uses an 
> API) to circumvent this security settings without informing the user should 
> be considered dubious at best and perhaps even malware.  In effect this is 
> disabling that security choice.  If the user has not selected this setting in 
> system prefs then there is no issue preventing screensaver from activating.  
> I’d recommend this criteria for the basis of whether to interfere with normal 
> system operations.
> 
> Sandor

Nobody said circumvent anything.
I believe a user would have to authorize an NSTask or similar usage anyway, 
unless they have disabled SIP.
I just provided reference to a tool that is already built and bundled that does 
this (less code) and the source to that tool (inspiration for other code).
I will not make any claims as to how that works with sandboxing. I 
whole-heartedly expect and want any such functionality to be made clear to 
users.
That said, it is easy to understand loads of legitimate use-cases for this.

___

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


Re: Prevent screen saver from starting, but don't prevent computer sleep

2020-06-29 Thread Sandor Szatmari via Cocoa-dev


> On Jun 28, 2020, at 22:29, じょいすじょん via Cocoa-dev  
> wrote:
> 
> One way to do this is with the command line tool:
> caffeinate
> 
> You could run a background task that starts it with something like 
> caffeinate -dimsu
> 
> You can probably also find its source code on opensource.apple.com to 
> understand what it does and how.
> 
> Like here is a version:
> 
> https://opensource.apple.com/source/PowerManagement/PowerManagement-637.20.2/caffeinate/caffeinate.c.auto.html
> 
> You certainly still want a user to approve things.

I would say that if the user has the checkbox selected in system preferences 
that ties sleep/screensaver to security (prompt for password on 
sleep/screensaver activation) they have already answered this question.  In 
this situation any app that calls caffeinate in the background (or uses an API) 
to circumvent this security settings without informing the user should be 
considered dubious at best and perhaps even malware.  In effect this is 
disabling that security choice.  If the user has not selected this setting in 
system prefs then there is no issue preventing screensaver from activating.  
I’d recommend this criteria for the basis of whether to interfere with normal 
system operations.

Sandor

> 
> 
> ___
> 
> 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


Re: Prevent screen saver from starting, but don't prevent computer sleep

2020-06-28 Thread じょいすじょん via Cocoa-dev
One way to do this is with the command line tool:
caffeinate

You could run a background task that starts it with something like 
caffeinate -dimsu

You can probably also find its source code on opensource.apple.com to 
understand what it does and how.

Like here is a version:

https://opensource.apple.com/source/PowerManagement/PowerManagement-637.20.2/caffeinate/caffeinate.c.auto.html

You certainly still want a user to approve things.


___

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


Re: Prevent screen saver from starting, but don't prevent computer sleep

2020-06-28 Thread Graham Cox via Cocoa-dev
In the “old days”, your app could periodically call UpdateSystemActivity( 
UsrActivity ) to prevent the screensaver kicking in. This has been deprecated 
since 10.8, but the header for that function says it can be replaced by 
IOPMAssertionCreateWithName(). I haven’t looked at that in detail or used it 
myself, but one of the defines for that function is 
‘kIOPMAssertionTypePreventUserIdleDisplaySleep’, which appears to do the same 
thing as the old UpdateSystemActivity() call.

Apologies if you already discussed this and rejected it for some reason, but 
otherwise, it may be worth checking out.

—Graham



> On 29 Jun 2020, at 5:31 am, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> Yes, agreed.  That is why I would like to disable ONLY the screensaver, 
> NOT System Preferences / Security / Require password ...
> 

___

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


Re: Prevent screen saver from starting, but don't prevent computer sleep

2020-06-28 Thread Sandor Szatmari via Cocoa-dev
G,

> On Jun 28, 2020, at 15:31, Gabriel Zachmann  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.
> 
> Yes, agreed.  That is why I would like to disable ONLY the screensaver, 
> NOT System Preferences / Security / Require password ...
The ability to disable the screensaver timeout/activation can be blocked by 
policy.  On a system configured this way, the only way to change this setting 
is from the OpenDirectory server or the policy server.  Any attempt to change 
screensaver timeout/activation settings locally, by you (your software) or even 
an admin user with physical access to the system can be disallowed.  

Sandor

> 
> Ideally, my app could bring up the password prompt itself before quitting.  
> Is that possible?
> 
> 
> 
> 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/archive%40mail-archive.com

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


Re: Prevent screen saver from starting, but don't prevent computer sleep

2020-06-28 Thread Gabriel Zachmann via Cocoa-dev
>> 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.

Yes, agreed.  That is why I would like to disable ONLY the screensaver, 
NOT System Preferences / Security / Require password ...

Ideally, my app could bring up the password prompt itself before quitting.  
Is that possible?



Best regards, Gabriel




smime.p7s
Description: S/MIME cryptographic signature
___

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


Re: Prevent screen saver from starting, but don't prevent computer sleep

2020-06-27 Thread Graham Cox via Cocoa-dev
You can make your app trigger a command-line program and pass params using 
NSTask. It’s not difficult to use. But in this case you might want to negotiate 
this with the user - apps that just go ahead and change MY system preferences 
are being user-hostile to say the least.

—Graham



> On 28 Jun 2020, at 2:46 am, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 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

___

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


Re: Prevent screen saver from starting, but don't prevent computer sleep

2020-06-27 Thread Sandor Szatmari via Cocoa-dev
G,

> On Jun 27, 2020, at 12:47, Gabriel Zachmann via Cocoa-dev 
>  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


Prevent screen saver from starting, but don't prevent computer sleep

2020-06-27 Thread Gabriel Zachmann via Cocoa-dev
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






smime.p7s
Description: S/MIME cryptographic signature
___

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