Files
Dotfiles/wallpaper/script.sh
2026-08-05 12:36:36 +02:00

43 lines
905 B
Bash
Executable File

#!/bin/bash
PATHNAME=~/wallpaper/
cd $PATHNAME
date=`date +"%H"`
#alway interprete data as decimal number
date="10#$date"
FOUND=-24
if [[ -f "last.txt" ]]; then
source "last.txt"
else
LAST_WALLPAPER=-1
fi
# until [[ -e "$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.hyprpaper.sock" ]]
# do
# sleep 0.1
# done
for filename in $(ls *.{jpg,JPG,png,PNG} | sort -g)
do
if (( ${filename%%.*} -date<=0 && ${filename%%.*} -date > ${FOUND%%.*} -date));then
FOUND=$filename
# if ((${FOUND%%.*}==-1));then
# FOUND=-2
# fi
fi
# LAST=$filename
done
echo $FOUND
sleep 1
if [[ "$LAST_WALLPAPER" != "$FOUND" || "$( hyprctl layers | grep hyprpaper )" == "" ]] ;then
echo "change to $FOUND"
awww img "$HOME/wallpaper/$FOUND" --transition-fps 60
magick "$HOME/wallpaper/$FOUND" -blur 0x20 - | awww img - -t none -n _backdrop
fi
echo "LAST_WALLPAPER=$FOUND" > last.txt