MacBook Air: Close lid and lock features I wonder if there is some way to customize the lock screen feature of my MacBook Air (running Mountain Lion) in such a way that:

1: When I close the lid, and then open it, the screen is not locked (that is, I do not have to type my password).

2: When I explicitly put the MacBook Air to sleep (with Power Button + Sleep option), and then wake it from sleep, the screen is locked (that is, I do have to write my password).



@bmike Thanks for for your response, but I think I did not explain clearly what I wanted. I wanted an easy way to put the computer to sleep and either not been asked for a password when it wakes (if I close the lid) or been asked for a password (when I explicitly put the computer to sleep).

@George Oross: Thanks for your response. I tried to find in the apple developers website some info on how to detect those signals, but made no advance.

I think that the best way to do that is to enable the "lock screen" menu item (via Keychain Access). If I want a "secure sleep" I first lock the screen through the menu and then close the lid to put it to sleep. If I want a "non-secure sleep" I simply close the lid.
No. What you want is not possible.

When the screen is closed the behavior is the same to the user as if it went into sleep from another reason such as pressing the power button. There isn't any way to have closing screen sleep (called clamshell sleep) set to have a different effect than any other kind of sleep through user-accessible preferences. If you have your mac set to require a password after waking in the security preferences then the mac will ask in both cases upon waking.

However, the mac internally codes the reasons for sleep differently. So the computer can tell clamshell from idle sleep, and also can tell if the mac went to sleep for another reason such as power button press, low power or high temperature. Therefore it is possible that a third party hack can use these codes to enable different behavior. I could not find one, though.

When the mac wakes up there are similar codes generated by the OS so that it knows if the computer was woken by opening the clamshell, wiggling the mouse, pressing the power button, waking for network access and so on. This seems to create another opening for a third party solution.