#!/bin/bash TIMEOUT=720 WALLPAPER=$(find $HOME/Pictures/Wallpapers/ -name '*' | awk '!/.git/' | tail -n +2 | shuf -n 1) PREVIOUS=$WALLPAPER wallpaperDir=$HOME/Pictures/Wallpapers/ wallpaperGit=$(grep url $wallpaperDir/.git/config | awk '{print $3}') #echo $WALLPAPER if [ -d $wallpaperDir ]; then num_files=$(ls -1 $wallpaperDir | wc -l) if [ $num_files -lt 1 ]; then notify-send -t 9000 "The wallpaper folder is expected to have more than 1 image. Exiting Wallsetter." exit else cd $wallpaperDir if [ -d ".git" ]; then git pull else notify-send -t 9000 "The wallpaper directory is expected to be a Git repository. Exiting Wallsetter." exit fi fi else /usr/bin/git clone $wallpaperGit $wallpaperDir chown -R $USER:ganome $wallpaperDir fi while true; do if [ "$WALLPAPER" == "$PREVIOUS" ]; then cd $wallpaperDir WALLPAPER=$(find $wallpaperDir -name '*' | awk '!/.git/' | tail -n +2 | shuf -n 1) WALLPAPER2=$(find $wallpaperDir -name '*' | awk '!/.git/' | tail -n +2 | shuf -n 1) else PREVIOUS=$WALLPAPER /usr/bin/swww img -o DP-1 --transition-type random --transition-step 16 --transition-fps 255 "$WALLPAPER" /usr/bin/swww img -o HDMI-A-1 --transition-type random --transition-step 16 --transition-fps 255 "$WALLPAPER2" sleep $TIMEOUT fi done