aboutsummaryrefslogtreecommitdiff
path: root/home-config/hypr/wallpaper-daemon.sh
diff options
context:
space:
mode:
Diffstat (limited to 'home-config/hypr/wallpaper-daemon.sh')
-rwxr-xr-xhome-config/hypr/wallpaper-daemon.sh35
1 files changed, 0 insertions, 35 deletions
diff --git a/home-config/hypr/wallpaper-daemon.sh b/home-config/hypr/wallpaper-daemon.sh
deleted file mode 100755
index b793c5a..0000000
--- a/home-config/hypr/wallpaper-daemon.sh
+++ /dev/null
@@ -1,35 +0,0 @@
1#!/usr/bin/env bash
2
3# Script initialization
4# Check if animated wallpapers exist, set env var if so
5# Sleep for swww init to finish
6init_static() {
7 # On battery or missing wallpapers, just load a random image
8 IMG=`find ~/.config/hypr/Wallpapers/static/ -type f | sort -R | tail -n1`
9 echo $IMG >> /tmp/$USER-desktop-anim
10 swww img $IMG
11}
12
13begin_randomizer() {
14 while :; do
15 sleep 3600
16 switch_check `find ~/.config/hypr/Wallpapers/static/ -type f | sort -R | tail -n1`
17 done
18}
19
20switch_check() {
21 # Simply query what image is displayed and make sure we do not overwrite
22 # it. This is more for animated wallpapers since it causes corruption
23 CURRENT_FILE=`swww query | awk -F'/' '{print $NF}'`
24 SELECTION=`echo $1 | awk -F'/' '{print $NF}'`
25
26 if ! [ "$CURRENT_FILE" == "$SELECTION" ]; then
27 # Update the file
28 sed -i '2c'"$1" /tmp/$USER-desktop-anim
29 # Set the background!
30 swww img $1
31 fi
32}
33
34init_static
35begin_randomizer &