Shutdown / Hibernation Prevention on Macs

I need to be able to implement methods to prevent them:

  • Shutdown
  • Restart
  • Logoff
  • Sleep

On Mac, I use Xcode, but I canโ€™t imagine the code to complete these steps.

Can someone help me here?

I found this: http://developer.apple.com/library/mac/#qa/qa1134/_index.html

but I canโ€™t figure out how to block system events when they fire.

thanks

+4
source share
2 answers

There is a SetSystemUIMode API in the Carbon Application Manager that allows you to manage (disable) things like force shutdown, window power key, etc. It is designed for kiosk-style applications and is described in this technical note .

Turn off sleep, screen saver, etc. made by periodically calling UpdateSystemActivity . See this Q&A technology .

+1
source

A simple and effective way to avoid Apple OSX for sleep is with the terminal command:

  $ pmset noidle
    Preventing idle sleep (^ C to exit) ...

The only unpleasant thing that maybe the user must finish this manually is by issuing "Control-C".

0
source

Source: https://habr.com/ru/post/1344088/


All Articles