53 lines
1.3 KiB
Nix
53 lines
1.3 KiB
Nix
{
|
|
mkWallpaperScript = { pkgs, config }: let
|
|
wallpapers = "/home/${config.ptw.system.singleUser}/Data/Wallpaper";
|
|
wallpapersHorizontal = "${wallpapers}/horizontal";
|
|
wallpapersVertical = "${wallpapers}/vertical";
|
|
in pkgs.writeShellScript "wallpaper.sh" ''
|
|
set -x
|
|
[[ $# -lt 1 ]] && echo "No profile specified" && exit 1
|
|
|
|
random_file() {
|
|
find "$1" -maxdepth 1 -type f | shuf -n 1
|
|
}
|
|
|
|
setbg() {
|
|
# Sets the background of $1 to $2
|
|
swaymsg "output \"$1\" background $2 fill"
|
|
}
|
|
|
|
case $1 in
|
|
homeMultihead)
|
|
horiz=$(random_file ${wallpapersHorizontal})
|
|
vert=$(random_file ${wallpapersVertical})
|
|
|
|
setbg "DP-2" $horiz
|
|
setbg "HDMI-A-3" $vert
|
|
;;
|
|
laptopMultihead)
|
|
horiz1=$(random_file ${wallpapersHorizontal})
|
|
horiz2=$(random_file ${wallpapersHorizontal})
|
|
|
|
setbg "eDP-1" $horiz1
|
|
setbg "HDMI-A-1" $horiz2
|
|
;;
|
|
genericMultihead)
|
|
horiz1=$(random_file ${wallpapersHorizontal})
|
|
horiz2=$(random_file ${wallpapersHorizontal})
|
|
|
|
setbg "eDP-1" $horiz1
|
|
setbg "HDMI-A-1" $horiz2
|
|
;;
|
|
laptop)
|
|
horiz=$(random_file ${wallpapersHorizontal})
|
|
|
|
setbg "eDP-1" $horiz
|
|
;;
|
|
esac
|
|
'';
|
|
mkProfile = { script, name, outputs }: {
|
|
outputs = outputs;
|
|
exec = "${script} ${name}";
|
|
};
|
|
}
|