Windows 8: How to Lock (not sleep) laptop on lid close?

If my laptop is connected to power source and is not configured to sleep on lid close (it is connected to power source and is working, I don't want it to sleep. It's compiling my code) if I close the lid, laptop will do nothing. This works as expected, but actually if I have my laptop connected to power source in the office it will be good to lock it if I close a lid. So no one can just open the lid and see my unlocked desktop.

I searched Google and it says that correct use case is to manually lock laptop via Win + L every time before lid is closed. This is OK, but not very secure - after all, I can forget Win + L.

Is there any easy way (maybe some registry value or app) to configure windows laptop so it will lock on lid close even without sleep? Of course I can write app/powershell script for this task, but this is not suitable for non-programmers end users.


Solution 1:

There is no built in way to do this, but you could use LidLock for this purpose. It is a GUI tool which can help you what you want to achieve. You can also set it to start automatically with Windows start-up.

enter image description here

enter image description here

You can also set the timer for sleep/hibernate after locking the laptop.

You can read more about this on this article.

Solution 2:

  1. Using Run from the start menu, execute regedit.

  2. Navigate to

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SessionManager\Power
    
  3. Right click > New > DWORD (32 bits)

  4. Rename it to AwayModeEnabled

  5. Select it > Right click > Change value to 1 (Hexadecimal)

  6. Go to the Power Options settings page and change the lid close action to sleep.

Source: Microsoft Answers - Lock computer on lid close?

Solution 3:

I wrote an alternative to the LidLock application suggested in other answers, called LapLock. What it does is simply listen for the lid close event and lock the computer when the event fires. Compared to LidLock mine is very bare-bones (it doesn't even have a UI), but also more lightweight.

Solution 4:

Here is another way to do it:

Under Choose what closing the lid does, select Do nothing for When I close the lid option.

Now, go to Change screen saver, and select Wait: 1 minutes and check On resume, display logon screen

Now, after closing your lid, for one minute, nothing happens, then it gets locked.

Is that it? No, not exactly. This won't work when any program prevents screen saver: like windows media player or vlc etc.

So, I guess this isn't the perfect solution, but it is one :)