2024-01-20 04:40:26 +01:00
|
|
|
{ pkgs, username, wallpaperDir, wallpaperGit, ... }:
|
2024-01-11 05:03:15 +01:00
|
|
|
|
|
|
|
pkgs.writeShellScriptBin "wallsetter" ''
|
2024-01-21 04:36:56 +01:00
|
|
|
TIMEOUT=720
|
2024-01-20 04:40:26 +01:00
|
|
|
TRANSITION1="--transition-type wave --transition-angle 120 --transition-step 30"
|
|
|
|
TRANSITION2="--transition-type wipe --transition-angle 30 --transition-step 30"
|
|
|
|
TRANSITION3="--transition-type center --transition-step 30"
|
|
|
|
TRANSITION4="--transition-type outer --transition-pos 0.3,0.8 --transition-step 30"
|
|
|
|
TRANSITION5="--transition-type wipe --transition-angle 270 --transition-step 30"
|
2024-01-21 04:45:01 +01:00
|
|
|
WALLPAPER=$(find ${wallpaperDir} -name '*' | awk '!/.git/' | tail -n +2 | shuf -n 1)
|
2024-01-20 04:40:26 +01:00
|
|
|
PREVIOUS=$WALLPAPER
|
2024-01-21 04:34:02 +01:00
|
|
|
if [ -d ${wallpaperDir} ]; then
|
|
|
|
cd ${wallpaperDir}
|
|
|
|
git pull
|
|
|
|
else
|
|
|
|
${pkgs.git}/bin/git clone ${wallpaperGit} ${wallpaperDir}
|
|
|
|
chown -R ${username}:users ${wallpaperDir}
|
|
|
|
fi
|
2024-01-20 04:40:26 +01:00
|
|
|
while true;
|
|
|
|
do
|
2024-01-21 04:34:02 +01:00
|
|
|
if [ "$WALLPAPER" == "$PREVIOUS" ]
|
2024-01-15 23:04:30 +01:00
|
|
|
then
|
2024-01-21 04:45:01 +01:00
|
|
|
WALLPAPER=$(find ${wallpaperDir} -name '*' | awk '!/.git/' | tail -n +2 | shuf -n 1)
|
2024-01-15 23:04:30 +01:00
|
|
|
else
|
2024-01-20 04:40:26 +01:00
|
|
|
PREVIOUS=$WALLPAPER
|
|
|
|
NUM=$(shuf -i 1-5 -n 1)
|
|
|
|
case $NUM in
|
|
|
|
1)
|
|
|
|
TRANSITION=$TRANSITION1
|
|
|
|
;;
|
|
|
|
2)
|
|
|
|
TRANSITION=$TRANSITION2
|
|
|
|
;;
|
|
|
|
3)
|
|
|
|
TRANSITION=$TRANSITION3
|
|
|
|
;;
|
|
|
|
4)
|
|
|
|
TRANSITION=$TRANSITION4
|
|
|
|
;;
|
|
|
|
5)
|
|
|
|
TRANSITION=$TRANSITION5
|
|
|
|
;;
|
|
|
|
esac
|
2024-01-21 04:57:30 +01:00
|
|
|
${pkgs.swww}/bin/swww img "$WALLPAPER" $TRANSITION
|
2024-01-20 04:40:26 +01:00
|
|
|
sleep $TIMEOUT
|
2024-01-15 23:04:30 +01:00
|
|
|
fi
|
2024-01-20 04:40:26 +01:00
|
|
|
done
|
2024-01-11 05:03:15 +01:00
|
|
|
''
|