os/pkgs/swaylock-bg.nix

20 lines
458 B
Nix
Raw Normal View History

2021-05-30 19:10:28 +00:00
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
2021-05-30 19:10:28 +00:00
exit 0
fi
IMAGE="$XDG_CONFIG_HOME/wallpaper.jpg"
2021-05-30 19:10:28 +00:00
LOCKARGS=""
for OUTPUT in $(${sway}/bin/swaymsg -t get_outputs | ${jq}/bin/jq -r '.[].name')
2021-05-30 19:10:28 +00:00
do
LOCKARGS="''${LOCKARGS} --image ''${OUTPUT}:''${IMAGE}"
done
exec ${swaylock}/bin/swaylock $LOCKARGS
''