nix-setup/sl.script.nix

27 lines
432 B
Nix
Raw Normal View History

2024-09-07 01:18:31 +02:00
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
''