52 lines
1.8 KiB
Plaintext
52 lines
1.8 KiB
Plaintext
|
|
#!/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
|
||
|
|
PREVWALL1=$WALLPAPER
|
||
|
|
PREVWALL2=$WALLPAPER2
|
||
|
|
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/hyprctl hyprpaper preload $WALLPAPER
|
||
|
|
/usr/bin/hyprctl hyprpaper wallpaper "DP-1,$WALLPAPER"
|
||
|
|
/usr/bin/hyprctl hyprpaper unload $PREVWALL1
|
||
|
|
/usr/bin/hyprctl hyprpaper preload $WALLPAPER2
|
||
|
|
/usr/bin/hyprctl hyprpaper wallpaper "HDMI-A-1,$WALLPAPER2"
|
||
|
|
/usr/bin/hyprctl hyprpaper unload $PREVWALL2
|
||
|
|
|
||
|
|
# /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
|