transform 'exec' to a 'while' loop to avoid recursion limitations
This commit is contained in:
parent
60080cb2f7
commit
3cec27788e
15
README.md
15
README.md
|
@ -1,9 +1,8 @@
|
||||||
# xlock screen locker
|
# xlock screen locker
|
||||||
|
|
||||||
`xlock` really does nothing, it uses and wraps [`i3lock`](https://github.com/i3/i3lock) into [systemd](https://freedesktop.org/wiki/Software/systemd/) to allow a seamless screen lock. You have as a background the screenshot of your current screen, the mouse pointer works, nothing can happen. You just have to type your password, press enter and here you go.
|
`xlock` really does nothing, it only wraps [`i3lock`](https://github.com/i3/i3lock) screen locker into [systemd](https://freedesktop.org/wiki/Software/systemd/) to allow a seamless screen lock. Your screen stays the same, the mouse pointer works, but you can't do anything. You just have to type your password, press enter and here you go .
|
||||||
|
|
||||||
|
Your friends and coworkers can try anything, they won't be able to do anything. Even if they find out how to kill the `i3lock` process, it won't unlock your computer.
|
||||||
Your friends and coworkers can be attempted, they won't succeed !
|
|
||||||
|
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
@ -12,15 +11,9 @@ Requirements :
|
||||||
- i3lock
|
- i3lock
|
||||||
- [scrot](https://phab.enlightenment.org/diffusion/ESVN/browse/trunk/misc/scrot;35502)
|
- [scrot](https://phab.enlightenment.org/diffusion/ESVN/browse/trunk/misc/scrot;35502)
|
||||||
|
|
||||||
run `./install.sh` ; you need sudo permissions.
|
run `./install.sh` ; note that you need sudo permissions.
|
||||||
|
|
||||||
### How to use
|
### How to use
|
||||||
A lock file is created at '/tmp/.unlocked'. To lock your screen, simply delete this file. After the install the service 'xlock@<user>.path' with `<user>` being your username during install. To start it `systemctl start xlock@user.path`, at the install it is enabled by default, so launched at boot.
|
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.
|
||||||
|
|
||||||
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 the `/tmp/.unlocked` file.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Security issues
|
|
||||||
|
|
||||||
Killin the `i3lock` process does not remove the locker.
|
|
10
src/xlock
10
src/xlock
|
@ -1,6 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
screenshot_f="/tmp/.lock.screenshot.png";
|
screenshot_f="/tmp/.lock.screenshot.png";
|
||||||
unlock_f="/tmp/.unlocked";
|
unlock_f="/tmp/.unlocked";
|
||||||
|
log_b="0";
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
|
||||||
# if lock file -> exit
|
# if lock file -> exit
|
||||||
if [ -f "$unlock_f" ]; then
|
if [ -f "$unlock_f" ]; then
|
||||||
|
@ -22,11 +25,8 @@ i3lock -n -u -p default -e -i $screenshot_f;
|
||||||
|
|
||||||
# if 'i3lock' has been killed or has error
|
# if 'i3lock' has been killed or has error
|
||||||
if [ "$?" -ne 0 ]; then
|
if [ "$?" -ne 0 ]; then
|
||||||
|
|
||||||
|
|
||||||
# re-lock
|
# re-lock
|
||||||
exec $0;
|
continue;
|
||||||
exit 0;
|
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
# create lock file
|
# create lock file
|
||||||
|
@ -35,3 +35,5 @@ chmod o=rwx $unlock_f;
|
||||||
|
|
||||||
# remove screenshot
|
# remove screenshot
|
||||||
rm -f $screenshot_f;
|
rm -f $screenshot_f;
|
||||||
|
|
||||||
|
done;
|
Loading…
Reference in New Issue