From e91baa3ae56442476a54cef95b06907ba6958145 Mon Sep 17 00:00:00 2001 From: Joachim Date: Sun, 19 Jul 2020 17:41:12 +0200 Subject: [PATCH] Tiny fixes. --- dot_dotfiles/polybar/config.tmpl | 2 +- scripts/executable_obelisk.status.sh | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dot_dotfiles/polybar/config.tmpl b/dot_dotfiles/polybar/config.tmpl index 416d0e3..4d04d74 100644 --- a/dot_dotfiles/polybar/config.tmpl +++ b/dot_dotfiles/polybar/config.tmpl @@ -385,7 +385,7 @@ label = %percentage_used%% [module/updates-arch] type = custom/script exec = ~/.config/polybar/polybar-scripts/polybar-scripts/updates-arch/updates-arch.sh -format-prefix = " " +format-prefix = "ﮮ " format-prefix-foreground = ${colors.bright_green} ;format-underline = ${colors.light3} interval = 600 diff --git a/scripts/executable_obelisk.status.sh b/scripts/executable_obelisk.status.sh index b31fb7f..55508f8 100644 --- a/scripts/executable_obelisk.status.sh +++ b/scripts/executable_obelisk.status.sh @@ -1,6 +1,6 @@ #!/bin/bash STATUSURL=https://obelisk.ilabt.imec.be/api/v2/status -STATUS=$(curl -s $STATUSURL | jq -r '.status') +STATUS=$(curl -s $STATUSURL | jq -r '.status' 2>/dev/null) # colors HEALTHY="#b8bb26" @@ -10,7 +10,11 @@ UNKNOWN="#928374" # echo the status in polybar format # the {F}x{F-} syntax allows you to color stuff -if [ $STATUS = "healthy" ]; then +# could have failed completely (network down etc) +if [ -z $STATUS ]; then + echo "%{F$UNKNOWN} %{F-} obelisk" +# expected statuses, healthy, degraded, failed +elif [ $STATUS = "healthy" ]; then echo "%{F$HEALTHY} %{F-} obelisk" elif [ $STATUS = "degraded" ]; then echo "%{F$DEGRADED} %{F-} obelisk"