26 lines
432 B
Nix
26 lines
432 B
Nix
with import <nixpkgs> {};
|
|
|
|
pkgs.writeShellScriptBin "sl" ''
|
|
#!/bin/sh
|
|
killall xss-lock i3lock
|
|
sleep 0.1
|
|
xss-lock --transfer-sleep-lock -- i3lock --nofork &
|
|
PID=$!
|
|
|
|
lastdate="$(date +%s)"
|
|
ok=0
|
|
sudo systemctl suspend
|
|
|
|
|
|
|
|
while kill -0 $PID ; do
|
|
if [ "$(($(date +%s) - $lastdate))" > 5 ] && [ "$ok" = 0 ] ; then
|
|
sudo systemctl restart fprintd
|
|
ok=1
|
|
sleep 2
|
|
fi
|
|
fprintd-verify && kill $PID
|
|
sleep 2
|
|
done
|
|
''
|
|
|