improve readme + make a real daemon
This commit is contained in:
parent
3cec27788e
commit
dd82c8abed
|
@ -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 .
|
`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
|
### Installation
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,15 @@ sudo cp "$local_d/src/xlock" "$bin_d/xlock";
|
||||||
sudo chmod +x "$bin_d/xlock";
|
sudo chmod +x "$bin_d/xlock";
|
||||||
|
|
||||||
# copy systemd files
|
# copy systemd files
|
||||||
printf "(2) copying systemd units\n";
|
printf "(2) copying systemd daemon\n";
|
||||||
sudo cp $local_d/systemd/* "$systemd_d";
|
sudo cp $local_d/systemd/* "$systemd_d";
|
||||||
|
|
||||||
# enable path
|
# enable path
|
||||||
printf "(3) enabling systemd watcher\n";
|
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"
|
printf "\n . install sucessful\n"
|
11
src/xlock
11
src/xlock
|
@ -5,9 +5,16 @@ log_b="0";
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
|
|
||||||
# if lock file -> exit
|
# if lock file -> wait for changes
|
||||||
if [ -f "$unlock_f" ]; then
|
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;
|
fi;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Locker lock file watcher
|
|
||||||
|
|
||||||
[Path]
|
|
||||||
PathModified=/tmp
|
|
||||||
Unit=xlock@%i.service
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -1,12 +1,15 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Locker daemon
|
Description=Locker daemon
|
||||||
|
# allows infinite restarts
|
||||||
|
StartLimitIntervalSec=0
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=simple
|
||||||
RemainAfterExit=false
|
|
||||||
User=%i
|
User=%i
|
||||||
Group=%i
|
Group=%i
|
||||||
|
|
||||||
|
Restart=always
|
||||||
|
|
||||||
Environment="DISPLAY=:0"
|
Environment="DISPLAY=:0"
|
||||||
Environment="XAUTHORITY=/home/%i/.Xauthority"
|
Environment="XAUTHORITY=/home/%i/.Xauthority"
|
||||||
ExecStart=/usr/sbin/xlock
|
ExecStart=/usr/sbin/xlock
|
Loading…
Reference in New Issue