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

Most of the time, I would like my Windows 7 laptop to sleep when I close it. But sometimes, I like to connect an external monitor over DVI.

I would like my laptop to use the external monitor when I close the lid, but only when a monitor is connected to the DVI port. Otherwise, sleep when closed.

Is there any way I can do that, without manually changing the power settings every time I decide to use the monitor?


Solution 1:

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.

Solution 2:

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.