40 lines
695 B
Bash
Executable File
40 lines
695 B
Bash
Executable File
#!/bin/bash
|
|
PATHNAME=~/wallpaper/
|
|
cd $PATHNAME
|
|
date=`date +"%H"`
|
|
|
|
FOUND=-24
|
|
|
|
if [[ -f "last.txt" ]]; then
|
|
source "last.txt"
|
|
else
|
|
LAST_WALLPAPER=-1
|
|
fi
|
|
|
|
until hyprctl -j monitors | grep -q " "
|
|
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"
|
|
hyprctl hyprpaper wallpaper ",$FOUND"
|
|
fi
|
|
|
|
echo "LAST_WALLPAPER=$FOUND" > last.txt
|