dynamic wallpapers :3

This commit is contained in:
2025-01-09 00:38:14 +01:00
parent 1652581f95
commit 3bdbf51983
4 changed files with 41 additions and 0 deletions

View File

@@ -0,0 +1 @@
/home/amy/.config/systemd/user/wallpaper.timer

View File

@@ -0,0 +1,6 @@
[Unit]
Description=Time based wallpaper switcher
[Service]
Type=simple
ExecStart=%h/wallpaper/script.sh

View File

@@ -0,0 +1,8 @@
[Unit]
Description=Run foo weekly and on boot
[Timer]
OnCalendar=minutely
Persistent=false
[Install]
WantedBy=timers.target

26
wallpaper/script.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/bash
PATHNAME=~/wallpaper/
cd $PATHNAME
printf -v date "%(%H)T"
LAST=-1
FOUND=-1
for filename in $(ls *.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
fi
hyprctl hyprpaper wallpaper ",$PATHNAME$FOUND"
echo ${FOUND%%.*}