feat: adapted to new hyprctl IPC that removed loaded grrrrr
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
do
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
LAST=-1
|
if [[ -f "last.txt" ]]; then
|
||||||
FOUND=-1
|
source "last.txt"
|
||||||
for filename in $(ls *.{jpg,JPG,png,PNG} | sort -g)
|
else
|
||||||
do
|
LAST_WALLPAPER=-1
|
||||||
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
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
hyprctl hyprpaper wallpaper ",$PATHNAME$FOUND"
|
until hyprctl -j monitors | grep -q " "
|
||||||
echo ${FOUND%%.*}
|
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