[lock,idle] Fixes the swaylock script to work for multiple monitors and fixes it's invocation
This commit is contained in:
@@ -12,12 +12,26 @@
|
||||
|
||||
home.file.".config/swaylock/swaylock.sh" = {
|
||||
executable = true;
|
||||
# A script that will take the wallpaper folder for each monitor (see
|
||||
# wallpaper.nix) and use a random image as the background on each monitor.
|
||||
text = ''
|
||||
#!/bin/env bash
|
||||
#!/usr/bin/env sh
|
||||
|
||||
image=`fd . ~/Pictures/Wallpaper --type f | sort -R | tail -1`
|
||||
wallpaper_dir="$HOME/Pictures/Wallpaper"
|
||||
cmd="swaylock"
|
||||
|
||||
swaylock --image "$image"
|
||||
for monitor in $(hyprctl monitors | awk '/^Monitor/ { print $2 }'); do
|
||||
dir="$wallpaper_dir/$monitor"
|
||||
if [ -d "$dir" ]; then
|
||||
image=$(find "$dir" -type f | shuf -n 1)
|
||||
if [ -n "$image" ]; then
|
||||
cmd="$cmd --image \"$monitor:$image\""
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Eval to handle the quoted image paths correctly
|
||||
eval $cmd
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user