infra/pkgs/swaylock-bg.nix
Benjamin Yule Bädorf 56ea689de6
feat: add nix config to this repository
This used to live in the old pub-solar/os repository in the `momo/main`
branch. This commit changes that so this repository has all code from
terraform to nix.
2024-02-25 17:41:25 +01:00

21 lines
458 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 $LOCKARGS
''