-
-
Save tilpner/bfe7ddce4fdbaaab2a9319ae0c023bec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ lib, writeShellScriptBin, coreutils, i3lock, scrot, imagemagick, | |
private ? true }: | |
let | |
path = lib.makeBinPath ([ | |
coreutils | |
i3lock | |
] ++ (lib.optionals (!private) [ | |
scrot | |
imagemagick | |
])); | |
in writeShellScriptBin "slock" '' | |
export PATH=${path} | |
${if private then '' | |
i3lock --show-failed-attempts -c 000000 | |
'' else '' | |
screen=/run/user/$UID/screen.png | |
convert x:root -scale 5% -sample 2000% -quality 30 $screen | |
i3lock --show-failed-attempts -i $screen | |
''} | |
pid=$! | |
wait $pid | |
[ -f "$screen" ] && rm $screen | |
'' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment