From 1c56301d201dfe6fe1b02709d9b86d9dcfd3c8fd Mon Sep 17 00:00:00 2001 From: Linus Yang Date: Fri, 9 Nov 2018 22:50:35 +0800 Subject: [PATCH 1/4] Title level in readme --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f3cd184..01cdf25 100644 --- a/README.md +++ b/README.md @@ -3,19 +3,19 @@ LidLock Lock Windows laptop when lid is closed -# Introduction +## Introduction LidLock is a simple app written in C for Windows to automatically lock the screen when the lid is closed. This resembles the same behavior as macOS, when one needs the laptop not to sleep but just to be locked when closing the lid. The app also works with clamshell mode and external monitors. It will ignore locking if lid is open and external monitors are connected, and re-locks if the lid is closed and external monitors are disconnected. -# Usage +## Usage LidLock is a single portable executable file. Simply double-click the executable and it silently runs as a daemon in the background without any windows, prompts or icons. It listens to relevant events and does not consume CPU when waiting. If you want to stop LidLock, you need to use Task Manager to stop the process. To make it run at startup, create a shortcut of `lidlock.exe` and copy the shortcut to the startup folder (can be opened by executing `shell:startup` in Win+R). -# Download and Compilation +## Download and Compilation The pre-compiled binaries can be found at [Releases][release] page. The binary can be cross-compiled using MinGW-w64 as follows: @@ -26,7 +26,7 @@ x86_64-w64-mingw32-gcc lidlock.c -o lidlock.exe -lole32 -lksguid -static -O2 -g0 For debugging, add a flag `-DDEBUG` during compiling and run the binary with a single argument which is the log file for tracking outputs. -# Credits +## Credits This app is based on [`laplock`][laplock] by @dechamps and rewritten in C. The extra feature is the support of external monitors. The license is the same as `laplock` (GPLv3): From 25495230399c04a5a0b6607014055c318eab3629 Mon Sep 17 00:00:00 2001 From: Linus Yang Date: Fri, 9 Nov 2018 22:55:29 +0800 Subject: [PATCH 2/4] Remove invalid logging --- lidlock.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lidlock.c b/lidlock.c index 7fce0eb..71f0c45 100644 --- a/lidlock.c +++ b/lidlock.c @@ -242,7 +242,6 @@ int CALLBACK WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR commandLi HANDLE mutex = CreateMutex(NULL, FALSE, TEXT(SINGLETON_IDENTIFIER)); DWORD err = GetLastError(); if (err == ERROR_ALREADY_EXISTS) { - LOG("instance already exists"); goto cleanup; } From 01899c95b5c71ed62b8fd126bbae405142adc30b Mon Sep 17 00:00:00 2001 From: Linus Yang Date: Fri, 7 Dec 2018 20:04:14 +0800 Subject: [PATCH 3/4] Rebuild and strip binaries --- lidlock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lidlock.c b/lidlock.c index 71f0c45..24d14b2 100644 --- a/lidlock.c +++ b/lidlock.c @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -//x86_64-w64-mingw32-gcc lidlock.c -o lidlock.exe -lole32 -lksguid -static -O2 -g0 -mwindows -Wall +//x86_64-w64-mingw32-gcc -s lidlock.c -o lidlock.exe -lole32 -lksguid -static -O2 -g0 -mwindows -Wall #include #include From 053e9b4f179cf4e8f98ed45a5a3d3bcb7bcf0879 Mon Sep 17 00:00:00 2001 From: linusyang92 <32575696+linusyang92@users.noreply.github.com> Date: Tue, 23 Apr 2019 12:22:14 +0800 Subject: [PATCH 4/4] Update README.md --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 01cdf25..e7c3037 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,10 @@ The app also works with clamshell mode and external monitors. It will ignore loc ## Usage LidLock is a single portable executable file. Simply double-click the executable and it silently runs as a daemon in the background without any windows, prompts or icons. It listens to relevant events and does not consume CPU when waiting. -If you want to stop LidLock, you need to use Task Manager to stop the process. +If you want to stop LidLock, you can use Task Manager to stop the process, or run the following command in cmd: +```cmd +taskkill /f /im lidlock.exe /t +``` To make it run at startup, create a shortcut of `lidlock.exe` and copy the shortcut to the startup folder (can be opened by executing `shell:startup` in Win+R). @@ -24,7 +27,11 @@ The binary can be cross-compiled using MinGW-w64 as follows: x86_64-w64-mingw32-gcc lidlock.c -o lidlock.exe -lole32 -lksguid -static -O2 -g0 -mwindows -Wall ``` -For debugging, add a flag `-DDEBUG` during compiling and run the binary with a single argument which is the log file for tracking outputs. +For debugging, add a flag `-DDEBUG` during compiling and run the binary with a single argument which is the log file for tracking outputs: + +```cmd +lidlock.exe debug.log +``` ## Credits This app is based on [`laplock`][laplock] by @dechamps and rewritten in C. The extra feature is the support of external monitors.