working demo
This commit is contained in:
commit
ddc84b2eb6
|
@ -0,0 +1,22 @@
|
||||||
|
# xlock screen locker
|
||||||
|
|
||||||
|
`xlock` really does nothing, it uses and wraps [`i3lock`]() into [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.
|
||||||
|
|
||||||
|
|
||||||
|
Your friends and coworkers can be attempted, they won't succeed !
|
||||||
|
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
run `./install.sh` ; you need sudo permissions.
|
||||||
|
|
||||||
|
### 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.
|
||||||
|
|
||||||
|
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.
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
user=`whoami`
|
||||||
|
local_d="$(realpath `dirname $0`)";
|
||||||
|
bin_d="/usr/sbin/";
|
||||||
|
systemd_d="/usr/lib/systemd/system";
|
||||||
|
|
||||||
|
# copy lock script
|
||||||
|
printf "(1) copying xlock executable\n";
|
||||||
|
sudo cp "$local_d/src/xlock" "$bin_d/xlock";
|
||||||
|
sudo chmod +x "$bin_d/xlock";
|
||||||
|
|
||||||
|
# copy systemd files
|
||||||
|
printf "(2) copying systemd units\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;
|
||||||
|
|
||||||
|
printf "\n . install sucessful\n"
|
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/bash
|
||||||
|
screenshot_f="/tmp/.lock.screenshot.png";
|
||||||
|
unlock_f="/tmp/.unlocked";
|
||||||
|
|
||||||
|
# if lock file -> exit
|
||||||
|
if [ -f "$unlock_f" ]; then
|
||||||
|
exit 0;
|
||||||
|
fi;
|
||||||
|
|
||||||
|
|
||||||
|
# take screenshot (if not exists)
|
||||||
|
if [ ! -f $screenshot_f ]; then
|
||||||
|
scrot $screenshot_f;
|
||||||
|
fi;
|
||||||
|
|
||||||
|
# lock w/ screenshot
|
||||||
|
i3lock -n -u -p default -e -i $screenshot_f;
|
||||||
|
# -n : no fork (does not work with systemd eitherway)
|
||||||
|
# -u : do not display lock indicator
|
||||||
|
# -p default : do not hide mouse pointer
|
||||||
|
# -e : ignore empty passwords
|
||||||
|
|
||||||
|
# if 'i3lock' has been killed or has error
|
||||||
|
if [ "$?" -ne 0 ]; then
|
||||||
|
|
||||||
|
|
||||||
|
# re-lock
|
||||||
|
exec $0;
|
||||||
|
exit 0;
|
||||||
|
fi;
|
||||||
|
|
||||||
|
# create lock file
|
||||||
|
touch $unlock_f;
|
||||||
|
chmod o=rwx $unlock_f;
|
||||||
|
|
||||||
|
# remove screenshot
|
||||||
|
rm -f $screenshot_f;
|
|
@ -0,0 +1,9 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Locker lock file watcher
|
||||||
|
|
||||||
|
[Path]
|
||||||
|
PathModified=/tmp
|
||||||
|
Unit=xlock@%i.service
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -0,0 +1,12 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Locker daemon
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=false
|
||||||
|
User=%i
|
||||||
|
Group=%i
|
||||||
|
|
||||||
|
Environment="DISPLAY=:0"
|
||||||
|
Environment="XAUTHORITY=/home/%i/.Xauthority"
|
||||||
|
ExecStart=/usr/sbin/xlock
|
Loading…
Reference in New Issue