diff --git a/.config/systemd/user/timers.target.wants/wallpaper.timer b/.config/systemd/user/timers.target.wants/wallpaper.timer new file mode 120000 index 0000000..6a7f387 --- /dev/null +++ b/.config/systemd/user/timers.target.wants/wallpaper.timer @@ -0,0 +1 @@ +/home/amy/.config/systemd/user/wallpaper.timer \ No newline at end of file diff --git a/.config/systemd/user/wallpaper.service b/.config/systemd/user/wallpaper.service new file mode 100644 index 0000000..891cb02 --- /dev/null +++ b/.config/systemd/user/wallpaper.service @@ -0,0 +1,6 @@ +[Unit] +Description=Time based wallpaper switcher + +[Service] +Type=simple +ExecStart=%h/wallpaper/script.sh diff --git a/.config/systemd/user/wallpaper.timer b/.config/systemd/user/wallpaper.timer new file mode 100644 index 0000000..1db6d86 --- /dev/null +++ b/.config/systemd/user/wallpaper.timer @@ -0,0 +1,8 @@ +[Unit] +Description=Run foo weekly and on boot + +[Timer] +OnCalendar=minutely +Persistent=false +[Install] +WantedBy=timers.target diff --git a/wallpaper/script.sh b/wallpaper/script.sh new file mode 100755 index 0000000..e968e73 --- /dev/null +++ b/wallpaper/script.sh @@ -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%%.*}