nixos/nate/dotfiles/sway/scripts/background.sh

31 lines
660 B
Bash
Raw Normal View History

2023-12-14 17:23:01 -07:00
#!/bin/bash
PID_FILE="background.pid"
WP_LOC="/home/nate/.config/sway/wallpapers"
PREV_WP=""
NEW_WP=$(ls $WP_LOC | sort -R | tail -n 1)
transition[0]="any"
transition[1]="wave"
transition[2]="outer"
transition[3]="wipe"
transition[4]="center"
size=${#transition[@]}
swww kill
swww init
# echo $(pgrep -f background.sh) > $PID_FILE
while true
do
while [[ $PREV_WP == $NEW_WP ]]
do
NEW_WP=$(ls $WP_LOC | sort -R | tail -n 1)
done
index=$(($RANDOM % $size))
#echo "Picked $WP_LOC/$NEW_WP with effect ${transition[$index]}"
swww img $WP_LOC/$NEW_WP --transition-type ${transition[$index]}
PREV_WP=$NEW_WP
sleep 120
done