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]
Description=Time based wallpaper switcher
#Requires=hyprpaper.service
#After=hyprpaper.service
PartOf=graphical-session.target
After=graphical-session.target hyprpaper.service
Requires=hyprpaper.service
After=graphical-session.target
[Service]
Type=simple

View File

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

View File

@@ -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