feat: adapted to new hyprctl IPC that removed loaded grrrrr
This commit is contained in:
@@ -1,31 +1,39 @@
|
||||
#!/bin/bash
|
||||
pidof hyprpaper || hyprctl dispatch exec hyprpaper
|
||||
PATHNAME=~/wallpaper/
|
||||
cd $PATHNAME
|
||||
printf -v date "%(%H)T"
|
||||
date=`date +"%H"`
|
||||
|
||||
until pid=$(hyprctl hyprpaper listloaded)
|
||||
do
|
||||
sleep 1
|
||||
done
|
||||
FOUND=-24
|
||||
|
||||
LAST=-1
|
||||
FOUND=-1
|
||||
for filename in $(ls *.{jpg,JPG,png,PNG} | sort -g)
|
||||
do
|
||||
if ((${filename%%.*} > date && ${FOUND%%.*} == -1));then
|
||||
#echo ${FOUND%%.*}
|
||||
FOUND=$LAST
|
||||
if ((${FOUND%%.*}==-1));then
|
||||
FOUND=-2
|
||||
fi
|
||||
fi
|
||||
LAST=$filename
|
||||
done
|
||||
|
||||
if ((${FOUND%%.*} < 0));then
|
||||
FOUND=$LAST
|
||||
if [[ -f "last.txt" ]]; then
|
||||
source "last.txt"
|
||||
else
|
||||
LAST_WALLPAPER=-1
|
||||
fi
|
||||
|
||||
hyprctl hyprpaper wallpaper ",$PATHNAME$FOUND"
|
||||
echo ${FOUND%%.*}
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user