How to disable screen saver / sleep display on Mac

Is there a way to turn off the screen saver and sleep mode using cocoa?

+7
source share
2 answers

I just decided it and forgot to post it as an answer. Call UpdateSystemActivity(OverallAct) every 30 seconds.

+4
source

Using UpdateSystemActivity (TotalAct) is deprecated in OSX 10.8.

The recommended approach is now to block it with the following call:

 IOPMAssertionCreateWithName(kIOPMAssertionTypePreventUserIdleDisplaySleep, kIOPMAssertionLevelOn, reasonForActivity, &assertionID); 

See this Apple Q & A for more details.

+7
source

All Articles