summary refs log tree commit diff
path: root/bin/oguri-cycle
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 /bin/oguri-cycle
parent730e6f482bf18c0e4c115b30043dc27a1fe45759 (diff)
bin/oguri-cycle: handle non-existing wallpapers
Diffstat (limited to '')
-rwxr-xr-xbin/oguri-cycle20
1 files changed, 14 insertions, 6 deletions
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
 }