31

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:

Power screen

Is there a hack to achieve this?

2
  • 6
    This is generally a bad idea: your laptop dissipates a good deal of heat through the keyboard, and if you leave the computer running with the lid closed, you risk overheating things.
    – Mark
    Apr 12, 2019 at 21:23
  • 18
    @Mark: ...and yet you can set it to keep running full blast when you close the lid, without frying anything.
    – Vikki
    Apr 13, 2019 at 3:26

4 Answers 4

27

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

  1. Download the program - https://github.com/dechamps/laplock/releases
    (Download the latest laplock.exe release)

  2. Open the Windows Startup folder by using this run command - 'shell:common startup'

  3. Add laplock.exe to your Startup folder.

You can also use Lid Lock to do this.

1
  • thanks, this implementation pretty much sums up the answer by mazunki, uses GUID_LIDSWITCH_STATE_CHANGE
    – Kevin
    Dec 5, 2019 at 0:57
9

Two steps:

  • Capture the close lid event.
  • Trigger a lock-screen event.

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.

2

The solution is simple, in options --> accounts --> Sign-in options: Require sign-in = Every Time

enter image description here

1
  • I do not see a "Require sign-in" option in that section. Below "Picture Password" I have "Dynamic Lock" ... "Privacy" ... but no Require sign-in.
    – feetwet
    Sep 7, 2020 at 19:05
0

Very likely because of the Extended Display Option set for the Monitor. Set the display only to Monitor, it should work.

1
  • 2
    Can you elaborate on this a little more?
    – Toto
    Oct 14, 2021 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.