os/pkgs/swaylock-bg.nix
teutat3s e15f6ad4ea
fix: swayidle 'command not found' and screen not
switching off after swaylock locks the screen
2023-11-11 15:43:09 +01:00

21 lines
470 B
Nix

self:
with self; ''
# Dependencies:
# swaylock
# Make sure we aren't running twice
RUNNING=$(${procps}/bin/pgrep -c ${swaylock}/bin/swaylock)
if [ "$RUNNING" -ne 0 ]; then
exit 0
fi
IMAGE="$XDG_CONFIG_HOME/wallpaper.jpg"
LOCKARGS=""
for OUTPUT in $(${sway}/bin/swaymsg -t get_outputs | ${jq}/bin/jq -r '.[].name')
do
LOCKARGS="''${LOCKARGS} --image ''${OUTPUT}:''${IMAGE}"
done
exec ${swaylock}/bin/swaylock --daemonize $LOCKARGS
''