feat: adapted to new hyprctl IPC that removed loaded grrrrr

This commit is contained in:
2026-01-10 15:42:26 +01:00
parent 2e53054f29
commit 6a384db287
3 changed files with 38 additions and 26 deletions

View File

@@ -1,7 +1,11 @@
[Unit] [Unit]
Description=Time based wallpaper switcher Description=Time based wallpaper switcher
#Requires=hyprpaper.service
#After=hyprpaper.service
PartOf=graphical-session.target
After=graphical-session.target hyprpaper.service
Requires=hyprpaper.service Requires=hyprpaper.service
After=graphical-session.target
[Service] [Service]
Type=simple Type=simple

View File

@@ -1,6 +1,6 @@
[Unit] [Unit]
Description=Run foo weekly and on boot Description=Run foo weekly and on boot
Requires=graphical-session.target Requires=graphical-session.target,hyprpaper.service
[Timer] [Timer]
OnCalendar=hourly OnCalendar=hourly

View File

@@ -1,31 +1,39 @@
#!/bin/bash #!/bin/bash
pidof hyprpaper || hyprctl dispatch exec hyprpaper
PATHNAME=~/wallpaper/ PATHNAME=~/wallpaper/
cd $PATHNAME cd $PATHNAME
printf -v date "%(%H)T" date=`date +"%H"`
until pid=$(hyprctl hyprpaper listloaded) FOUND=-24
if [[ -f "last.txt" ]]; then
source "last.txt"
else
LAST_WALLPAPER=-1
fi
until hyprctl -j monitors | grep -q " "
do do
sleep 1 sleep 0.1
done done
LAST=-1
FOUND=-1
for filename in $(ls *.{jpg,JPG,png,PNG} | sort -g) for filename in $(ls *.{jpg,JPG,png,PNG} | sort -g)
do do
if ((${filename%%.*} > date && ${FOUND%%.*} == -1));then if (( ${filename%%.*} -date<=0 && ${filename%%.*} -date > ${FOUND%%.*} -date));then
#echo ${FOUND%%.*} FOUND=$filename
FOUND=$LAST # if ((${FOUND%%.*}==-1));then
if ((${FOUND%%.*}==-1));then # FOUND=-2
FOUND=-2 # fi
fi fi
fi # LAST=$filename
LAST=$filename
done done
if ((${FOUND%%.*} < 0));then echo $FOUND
FOUND=$LAST
sleep 1
if [[ "$LAST_WALLPAPER" != "$FOUND" || "$( hyprctl layers | grep hyprpaper )" == "" ]] ;then
echo "change to $FOUND"
hyprctl hyprpaper wallpaper ",$FOUND"
fi fi
hyprctl hyprpaper wallpaper ",$PATHNAME$FOUND" echo "LAST_WALLPAPER=$FOUND" > last.txt
echo ${FOUND%%.*}