• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cancel Sleep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cancel Sleep


  • Subject: Re: Cancel Sleep
  • From: Stephen Hoffman <email@hidden>
  • Date: Mon, 31 Dec 2007 17:23:17 -0500
  • Organization: HoffmanLabs LLC

Andrew James writes
The users are 100% fine with the idea and all i want to know is if its possible and if so how, it seems no matter where i ask this question i am confronted with other developers views and not a solution

There are several fully supported approaches toward this end.


The easiest is to go to System Preferences, to Energy Saver, and to disable sleep.

I'd expect you could probably toss an AppleScript after the preferences, too. Here are some related articles to that end:

http://macscripter.net/articles/468_0_10_0_C/
http://www.apple.com/applescript/features/system-prefs.html

Or you could fully manage the user's environment and settings, establish the requisite settings, and lock out access to the Energy Saver preferences. This is often best in a production-oriented environment, as it avoids dealing with changes to the run-time.

And then there is the pmset tool available at the shell. See man pmset for details on that. Here are some details from the Darwin source pool:

http://www.opensource.apple.com/darwinsource/10.5/PowerManagement/
http://www.opensource.apple.com/darwinsource/10.5/IOKitUser/pwr_mgt.subproj/
http://www.opensource.apple.com/darwinsource/10.5/xnu/iokit/IOKit/pwr_mgt/

Off-hand, I don't know if there's a way to capture an (asynchronous) change in the user's preferences settings. That might well be massively useful here. With the change notification, you could react appropriately at run time. And regardless of the preferences settings, I'd still tend to code to expect to see a sleep request at run-time. The "big sleep" here being a hard power-down, and that's something you still have to plan for.

When it is difficult or impossible to find official documentation within a particular area of an operating system, there's usually a reason for the omission. One of those can be a wish to avoid support costs. (That's as close as I'll come to expressing a view here.)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Prev by Date: Re: Cancel Sleep
  • Next by Date: darwinbuild for gcc_os using 9A581.plist
  • Previous by thread: Re: Cancel Sleep
  • Next by thread: Maximum name length for MacOS Extended?
  • Index(es):
    • Date
    • Thread