38 lines
935 B
Nix
38 lines
935 B
Nix
{ pkgs, ... }:
|
|
{
|
|
programs.swaylock = {
|
|
enable = true;
|
|
package = pkgs.swaylock-effects;
|
|
settings = {
|
|
clock = true;
|
|
indicator = true;
|
|
effect-pixelate = 20;
|
|
};
|
|
};
|
|
|
|
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 = ''
|
|
#!/usr/bin/env sh
|
|
|
|
wallpaper_dir="$HOME/Pictures/Wallpaper"
|
|
cmd="swaylock"
|
|
|
|
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
|
|
'';
|
|
};
|
|
}
|