The conversation on this page has been archived and is no longer active.

Sleep on close

Message #1 - Posted 2012/04/07 - Howard S Shubs

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.

May joy be yours all the days of your life! - Phina
We are but a moment's sunlight, fading in the grass. - The Youngbloods Those who eat natural foods die of natural causes. - Kperspective

Message #2 - Posted 2012/04/08 - dorayme

Previously, Howard S Shubs 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?

dorayme

Message #3 - Posted 2012/04/07 - unfrostedpoptart

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

Previously, Howard S Shubs 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

Message #4 - Posted 2012/04/07 - unfrostedpoptart

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:

Previously, Howard S Shubs 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

Message #5 - Posted 2012/04/08 - Howard S Shubs

Previously, dorayme wrote:

Previously, Howard S Shubs 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.

May joy be yours all the days of your life! - Phina
We are but a moment's sunlight, fading in the grass. - The Youngbloods Those who eat natural foods die of natural causes. - Kperspective

Message #6 - Posted 2012/04/08 - David Empson

Howard S Shubs wrote:

Previously, dorayme wrote:

Previously, Howard S Shubs 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.

3. 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.

David Empson
dempson@actrix.gen.nz

Message #7 - Posted 2012/04/10 - dorayme

Previously, unfrostedpoptart 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...

dorayme

Need Help? Have a Question?

Looking for more help, comments, and answers?

Ask your questions on Ask Different. Ask Different is a community of Apple users ready to help.