improve readme + make a real daemon

This commit is contained in:
xdrm-brackets 2019-03-03 14:01:16 +01:00
parent 3cec27788e
commit dd82c8abed
5 changed files with 21 additions and 17 deletions

View File

@ -2,8 +2,7 @@
`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.
Even if one finds out how to kill the `i3lock` process or the `xlock` one, it won't unlock your screen.
### Installation

View File

@ -11,11 +11,15 @@ sudo cp "$local_d/src/xlock" "$bin_d/xlock";
sudo chmod +x "$bin_d/xlock";
# copy systemd files
printf "(2) copying systemd units\n";
printf "(2) copying systemd daemon\n";
sudo cp $local_d/systemd/* "$systemd_d";
# enable path
printf "(3) enabling systemd watcher\n";
sudo systemctl enable "xlock@$user.path" > /dev/null 2>&1;
sudo systemctl enable "xlock@$user.service" > /dev/null 2>&1;
# sudo systemctl enable "xlock@$user.path" > /dev/null 2>&1;
# reload systemd if not first install
sudo systemctl daemon-reload;
printf "\n . install sucessful\n"

View File

@ -5,9 +5,16 @@ log_b="0";
while true; do
# if lock file -> exit
# if lock file -> wait for changes
if [ -f "$unlock_f" ]; then
exit 0;
# wait while file exists
while [ -f "$unlock_f" ]; do
sleep 1;
done;
# re-lock when deleted
continue;
fi;

View File

@ -1,9 +0,0 @@
[Unit]
Description=Locker lock file watcher
[Path]
PathModified=/tmp
Unit=xlock@%i.service
[Install]
WantedBy=multi-user.target

View File

@ -1,12 +1,15 @@
[Unit]
Description=Locker daemon
# allows infinite restarts
StartLimitIntervalSec=0
[Service]
Type=oneshot
RemainAfterExit=false
Type=simple
User=%i
Group=%i
Restart=always
Environment="DISPLAY=:0"
Environment="XAUTHORITY=/home/%i/.Xauthority"
ExecStart=/usr/sbin/xlock