summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2022-11-24 21:13:56 +0100
committerRobert Günzler <r@gnzler.io>2022-11-24 21:16:10 +0100
commit0845d8db118b2d10c5c5972db23ca3378d6618cb (patch)
tree30f1b321afea4d0cafacd9618bdaceac2799f58b
parent730e6f482bf18c0e4c115b30043dc27a1fe45759 (diff)
bin/oguri-cycle: handle non-existing wallpapers
-rw-r--r--.config/oguri/config4
-rwxr-xr-xbin/oguri-cycle20
2 files changed, 15 insertions, 9 deletions
diff --git a/.config/oguri/config b/.config/oguri/config
index 8a4e5d0..0beb0b1 100644
--- a/.config/oguri/config
+++ b/.config/oguri/config
@@ -1,6 +1,4 @@
 [output *]
-image=/home/robert/.config/oguri/ripples.jpg
-# image=/home/robert/.config/oguri/leaves.jpg
-# image=/home/robert/.config/oguri/ginko.png
+image=~/.config/oguri/ripples.jpg
 scaling-mode=tile
 filter=best
diff --git a/bin/oguri-cycle b/bin/oguri-cycle
index 36394b2..c09c712 100755
--- a/bin/oguri-cycle
+++ b/bin/oguri-cycle
@@ -17,12 +17,20 @@ fi
 
 change_bg() {
 	for o in "${OUTPUTS[@]}"; do
-		idx=$((0 + RANDOM % ${#BGS[@]}))
-		ogurictl output "${o}" \
-			--image "${BGS[${idx}]}" \
-			--filter best \
-			--scaling-mode fill \
-			--anchor center
+		if [ ${#BGS} -gt 0 ]; then
+			idx=$((0 + RANDOM % ${#BGS[@]}))
+			ogurictl output "${o}" \
+				--image "${BGS[${idx}]}" \
+				--filter best \
+				--scaling-mode fill \
+				--anchor center
+		else
+			ogurictl output "${o}" \
+				--image "$(grep image "${XDG_CONFIG_HOME}"/oguri/config | cut -d= -f2)" \
+				--filter best \
+				--scaling-mode tile \
+				--anchor center
+		fi
 	done
 }