update readme + random lock file + cleanup code
This commit is contained in:
parent
dd82c8abed
commit
68911239ff
|
@ -13,6 +13,6 @@ Requirements :
|
|||
run `./install.sh` ; note that you need sudo permissions.
|
||||
|
||||
### How to use
|
||||
The whole wrapper interfaces through a simple file at `/tmp/.unlocked`. To lock your screen, simply delete this file. After the install the service 'xlock@USER.path' with `USER` being the user that launched the install. To start it `systemctl start xlock@USER.path`, at the install it is enabled by default, thus it is launched when you boot.
|
||||
The whole wrapper interfaces through a random file at `/tmp/RANDOM.xlock`. To lock your screen, simply delete this file. After the install the service 'xlock@USER.path' with `USER` being the user that launched the install. To start it `systemctl start xlock@USER.path`, at the install it is enabled by default, thus it is launched when you boot.
|
||||
|
||||
To add a key binding or to automate your script lock, simply delete the `/tmp/.unlocked` file.
|
||||
To add a key binding or to automate your script lock, simply delete files for the pattern `/tmp/*.xlock`.
|
11
src/xlock
11
src/xlock
|
@ -1,21 +1,18 @@
|
|||
#!/bin/bash
|
||||
screenshot_f="/tmp/.lock.screenshot.png";
|
||||
unlock_f="/tmp/.unlocked";
|
||||
unlock_f="`mktemp --suffix=.xlock`";
|
||||
log_b="0";
|
||||
|
||||
rm "$unlock_f";
|
||||
|
||||
while true; do
|
||||
|
||||
# if lock file -> wait for changes
|
||||
if [ -f "$unlock_f" ]; then
|
||||
|
||||
# wait while file exists
|
||||
# if lock file -> wait until it is deleted
|
||||
while [ -f "$unlock_f" ]; do
|
||||
sleep 1;
|
||||
done;
|
||||
|
||||
# re-lock when deleted
|
||||
continue;
|
||||
fi;
|
||||
|
||||
|
||||
# take screenshot (if not exists)
|
||||
|
|
Loading…
Reference in New Issue