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

31 lines
668 B
Bash
Executable File

#!/usr/bin/env 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