If my laptop is plugged in I want closing the lid to automatically lock the computer, without putting it to sleep. I don't see an option to do this in Power Options:
Is there a hack to achieve this?
If my laptop is plugged in I want closing the lid to automatically lock the computer, without putting it to sleep. I don't see an option to do this in Power Options:
Is there a hack to achieve this?
As far as I know, there is no built-in function to achieve this. But you can do this using a third party tool.
One of them is LapLock. This program is a lightweight (<50KB), open source tool and it's developed by Etienne Dechamps.
Steps...
Download the program - https://github.com/dechamps/laplock/releases
(Download the latest laplock.exe release)
Open the Windows Startup folder by using this run command - 'shell:common startup
'
Add laplock.exe to your Startup folder.
You can also use Lid Lock to do this.
Every time
in Windows Require sign-in
option which is described in the other answer. But I don't like this behavior, so I forked laplock, so it locks the computer only after closing the lid. This way, my computer automatically locks after 15 minutes (this is set instead of Every time
in Windows settings) OR when I close the lid. Screen turning off or computer going into sleep doesn't trigger the lock. Here's release with the updated binary: github.com/tpwo/laplock/releases/tag/0.3
Two steps:
See: Capturing laptop lid closing event in windows?, and Command-line (cmd) command to lock a windows machine.
From those sources, we can use RegisterPowerSettingNotification
and GUID_LIDSWITCH_STATE_CHANGE
to detect the trigger, and run:
rundll32.exe user32.dll,LockWorkStation
from the command line to send a lock screen request to the machine.
I don't know what compilers you have available, or what languages you know, but this information should help you set up a program to do it for you.
I don't use Windows myself, so I can't build or test it for you.
Very likely because of the Extended Display Option set for the Monitor. Set the display only to Monitor, it should work.