Sleep on close

Is there a way to restore the old "sleep on close" behavoir for MacBook Pros?
Howard S Shubs wrote on :
Is there a way to restore the old "sleep on close" behavoir for MacBook Pros? Now it simply shuts off the screen if you close it, and rearranges the Desktop.
dorayme replied on :

In article howard-1871F5.12055007042012@redacted.invalid, Howard S Shubs howard@redacted.invalid wrote:

Is there a way to restore the old "sleep on close" behavoir for MacBook Pros? Now it simply shuts off the screen if you close it, and rearranges the Desktop.

DE said to me:

" ...

"hibernatation mode". It is controlled by a hidden setting, and is normally enabled for notebook models, disabled for desktop models. This command in Terminal shows the current power management settings for all power modes:

pmset -g custom

Look for the "hibernatemode" line under the Battery Power and AC Power headings. The only modes which should be used, from the man page: hibernatemode = 0 is the default on supported desktops. The system will not back memory up to persistent storage. The system must wake from the contents of memory; the system will lose context on power loss. This is, historically, plain old sleep. hibernatemode = 3 is the default on supported portables. The system will store a copy of memory to persistent storage (the disk), and will power memory during sleep. The system will wake from memory, unless a power loss forces it to restore from disk image.

hibernatemode = 25 is only settable via pmset. The system will store a copy of memory to persistent storage (the disk), and will remove power to memory. The system will restore from disk image. If you want "hibernation" - slower sleeps, slower wakes, and better battery life, you should use this setting. [end quote]

If you want to change the setting, you need to be logged in as an admin user and use the 'sudo' command to execute the command with root priveleges. It will ask for a password - enter your account password. Assuming you want to disable hibernation completely:

sudo pmset -a hibernatemode 0

The -a option specifies all power sources.

If you want different modes for when running on power adapter or battery (at the point the computer goes to sleep), you will need to enter the command twice, replacing -a with -b for battery or -c for charger, and replacing 0 with the desired mode."

Interesting as this is, my problem, a sudden change in the time it took for my MB to go to sleep after lid close or key command, fixed it itself for a reason I have no idea about. A week or so after DE replied and I looked into the matter, it suddenly worked as it used to work for years. I will spare you details but just make the point that mysterious things can happen with Sleep, logging off and on, sys prefs and other settings, and sometimes it is hard to pin down, there maybe some instabilities in the OS?

unfrostedpoptart replied on :

On Saturday, April 7, 2012 2:10:14 PM UTC-7, dorayme wrote:

In article howard-...@redacted.invalid, Howard S Shubs howard@redacted.invalid wrote:

Is there a way to restore the old "sleep on close" behavoir for MacBook Pros? Now it simply shuts off the screen if you close it, and rearranges the Desktop.

DE said to me:

"hibernatation mode". It is controlled by a hidden setting, and is normally enabled for notebook models, disabled for desktop models. This command in Terminal shows the current power management settings for all power modes:

pmset -g custom

Thanks so much for this info! I never heard of the pmset command. For years I made fun of people at work who carried around their Windows laptops half open so they wouldn't turn off when they could easily change the settings for closing the screen. Now it's been joke on me with my new MBA and doing the same thing! I'll have to study all the options more to set this up the way I want.

Any nice GUI app / pref pane that is a front end for this?

David

unfrostedpoptart replied on :

On Saturday, April 7, 2012 9:46:27 PM UTC-7, unfrostedpoptart wrote:

On Saturday, April 7, 2012 2:10:14 PM UTC-7, dorayme wrote:

In article howard-...@redacted.invalid, Howard S Shubs howard@redacted.invalid wrote:

Is there a way to restore the old "sleep on close" behavoir for MacBook Pros? Now it simply shuts off the screen if you close it, and rearranges the Desktop.

DE said to me:

"hibernatation mode". It is controlled by a hidden setting, and is normally enabled for notebook models, disabled for desktop models. This command in Terminal shows the current power management settings for all power modes:

pmset -g custom

Thanks so much for this info! I never heard of the pmset command. For years I made fun of people at work who carried around their Windows laptops half open so they wouldn't turn off when they could easily change the settings for closing the screen. Now it's been joke on me with my new MBA and doing the same thing! I'll have to study all the options more to set this up the way I want.

Spoke too soon :( sudo pmset -a lidwake 0 Does stop it from automatically turning on when I open the lid but it doesn't stop it from going to sleep when I close the lid! I know this thread was started to get it to sleep when closing, but I'm trying to have it not do that. Anyone know why this isn't working? Several forum articles I've found said it should but maybe it's changed in Lion or something on the 2011 MBA.

David

Howard S Shubs replied on :

In article dorayme-C3EE09.07101408042012@redacted.invalid, dorayme dorayme@redacted.invalid wrote:

In article howard-1871F5.12055007042012@redacted.invalid, Howard S Shubs howard@redacted.invalid wrote:

Is there a way to restore the old "sleep on close" behavoir for MacBook Pros? Now it simply shuts off the screen if you close it, and rearranges the Desktop.

DE said to me:

" ...

"hibernatation mode". It is controlled by a hidden setting, and is normally enabled for notebook models, disabled for desktop models. This command in Terminal shows the current power management settings for all power modes:

pmset -g custom

Look for the "hibernatemode" line under the Battery Power and AC Power headings. The only modes which should be used, from the man page: hibernatemode = 0 is the default on supported desktops. The system will not back memory up to persistent storage. The system must wake from the contents of memory; the system will lose context on power loss. This is, historically, plain old sleep. hibernatemode = 3 is the default on supported portables. The system will store a copy of memory to persistent storage (the disk), and will power memory during sleep. The system will wake from memory, unless a power loss forces it to restore from disk image.

That's what it's set to. I wonder if the external monitor is what's changing things. Thanks.

David Empson replied on :

Howard S Shubs howard@redacted.invalid wrote:

In article dorayme-C3EE09.07101408042012@redacted.invalid, dorayme dorayme@redacted.invalid wrote:

In article howard-1871F5.12055007042012@redacted.invalid, Howard S Shubs howard@redacted.invalid wrote:

Is there a way to restore the old "sleep on close" behavoir for MacBook Pros? Now it simply shuts off the screen if you close it, and rearranges the Desktop.

DE said to me:

" ...

"hibernatation mode". It is controlled by a hidden setting, and is normally enabled for notebook models, disabled for desktop models. This command in Terminal shows the current power management settings for all power modes:

pmset -g custom

Look for the "hibernatemode" line under the Battery Power and AC Power headings. The only modes which should be used, from the man page: hibernatemode = 0 is the default on supported desktops. The system will not back memory up to persistent storage. The system must wake from the contents of memory; the system will lose context on power loss. This is, historically, plain old sleep. hibernatemode = 3 is the default on supported portables. The system will store a copy of memory to persistent storage (the disk), and will power memory during sleep. The system will wake from memory, unless a power loss forces it to restore from disk image.

That's what it's set to. I wonder if the external monitor is what's changing things. Thanks.

If you have an external monitor plugged in, then what is supposed to happen on closing the lid is:

  1. Computer goes to sleep.

  2. If you have an external keyboard or mouse (USB or Bluetooth), press a key, move the mouse, or do something else which wakes up the computer, it will operate in "clamshell" mode, where the internal display is disabled and the external display is the primary (and only) display. Assuming they are different resolutions, this will result in the desktop being rearranged.

If something prevented the computer going to sleep when the lid was closed, then an external display would trigger immediately going into clamshell mode.

  1. If you open the lid again, the normal arrangement is restored, so the built-in display becomes the primary, resulting in another round of icon rearrangements.

I'm not aware of any settings to configure this behaviour.

dorayme replied on :

In article 23219543.203.1333862925638.JavaMail.geo-discussion-forums@redacted.invalid, unfrostedpoptart david@redacted.invalid wrote:

I know this thread was started to get it [MB] to sleep when closing, but I'm trying to have it not do that.

Mine can be awake and spinning away with the lid closed on my desk, where it is connected to an external screen and usb keyboard. They call this clamshell mode for obvious reasons. I never do this now because it surely breathes a bit better (through the keyboard) with the lid open and I can still spare the screen by dimming it to zero.

Why you would want to be able to prevent sleep on closing the lid when it is not connected to external monitors, I am not sure? Perhaps if you are connected to the internet wirelessly and are up or downloading or waiting for an email while walking about with the MB? However, you might perhaps, instead, set Sys Prefs for Energy to wake on network activity, not put the HD to sleep...