Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Prevent from sleeping #8

Open
arpachain-admin opened this issue Mar 22, 2019 · 2 comments
Open

Prevent from sleeping #8

arpachain-admin opened this issue Mar 22, 2019 · 2 comments

Comments

@arpachain-admin
Copy link

arpachain-admin commented Mar 22, 2019

My MBP13 2018 consumes a lot of power overnight. And especially when I am travelling, the power get completely drain. This is really annoying. So I did some search and found this command: pmset -g assertions
Then I got this result:

Assertion status system-wide:
BackgroundTask 0
ApplePushServiceTask 0
UserIsActive 1
PreventUserIdleDisplaySleep 0
PreventSystemSleep 0
ExternalMedia 0
PreventUserIdleSystemSleep 1
NetworkClientActive 0
Listed by owning process:
pid 87941(Brightness): [0x0005897d00018c7a] 00:02:40 PreventUserIdleSystemSleep named: "Prevent app nap from pausing brightness sync."
pid 110(hidd): [0x00057319000988f2] 00:00:00 UserIsActive named: "com.apple.iohideventsystem.queue.tickle.4295505597.3"
Timeout will fire in 1800 secs Action=TimeoutActionRelease

It seems that brightness app has been preventing the mac from sleeping.

Can you fix?

@baragona
Copy link
Owner

App nap is disabled on this app because it macOS will pause the app and make its timers run very very slowly otherwise.

I wasn't aware that this actually prevents the computer from sleeping. Are you sure this is the case? I am not too familiar with this.

Can you think of any work arounds that will allows the computer to sleep while not affecting the performance of this app?

@callzhang
Copy link

callzhang commented Nov 21, 2019

I have the similar problem. I am not familiar with MacOS development, but the following thoughts may help you:

  1. Enable App nap and listen to system event described. The system should wake the app up. (at least in iOS it will)
  2. Listen to system event about "lid close", enable app nap then. And vise versa.
  3. Dig more about the reason that prevent the system from sleeping - is it really the app nap option?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants