How to tell Windows 7 "sleep when laptop is closed, unless there's an external monitor connected; then use that"?

AFAIK, no, that is not possible, at least not inherent to Windows. Perhaps the option that is least likely to drive you crazy is to set closing the lid to "do nothing". Then just press the power button when you want to sleep and get used to doing that. (And use the menu option for hibernate or anything else.) I find that it's not just an external monitor, but anytime I'm walking to another room I'm going to close the lid without wanting it to sleep.


It's not exactly what you're looking for, but under Control Panel\All Control Panel Items\Power Options\System Settings, it has separate settings for what happens when you close the lid depending on whether you're plugged in or on battery. I find that when I'm using an external monitor, I'm typically also plugged in. So I set the lid close action to "Do nothing" when plugged in, and "Sleep" when on battery. This mostly solves the above problem for me.