Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable the screen saver/display sleep on Mac

Is there a way to disable the screen saver and the display sleep with cocoa?

like image 978
lbrndnr Avatar asked Feb 26 '11 12:02

lbrndnr


People also ask

How do I stop my Mac from going into screen saver mode?

To change these preferences, choose Apple menu > System Preferences, click Desktop & Screen Saver , then click Screen Saver. Choose how long your Mac can be inactive before the screen saver starts. If you don't want to use a screen saver, deselect the checkbox.

Why does my Mac sleep instead of screensaver?

It sounds like your Mac will indeed never go to sleep, but the Screen Saver is set to activate after 15 minutes. You can disable the screen saver by opening the Desktop & Screen Saver preference pane in System Preferences then selecting Never in the drop down box in the bottom left corner of the window.

How do I change how long my Mac screen stays on?

From the Apple menu, choose System Preferences. Click Desktop & Screen Saver. Click Screen Saver, and then use the slider to choose 15 minutes (or less).


1 Answers

The use of UpdateSystemActivity(OverallAct) has been 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 further details.

like image 64
Giles Avatar answered Sep 23 '22 18:09

Giles