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: Mon, 29 Jun 2020 06:56:39 -0400
> On Jun 29, 2020, at 02:46, じょいすじょん <email@hidden> wrote:
>
>
>
>>> On Jun 29, 2020, at 15:24, Sandor Szatmari <email@hidden>
>>> wrote:
>>>
>>>
>>>
>>>> On Jun 28, 2020, at 22:29, じょいすじょん via Cocoa-dev
>>>> <email@hidden> 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 (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