From 0845d8db118b2d10c5c5972db23ca3378d6618cb Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Thu, 24 Nov 2022 21:13:56 +0100 Subject: bin/oguri-cycle: handle non-existing wallpapers --- .config/oguri/config | 4 +--- bin/oguri-cycle | 20 ++++++++++++++------ 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 } -- cgit 1.4.1