Tiny fixes.

This commit is contained in:
Joachim 2020-07-19 17:41:12 +02:00
parent a97f5d52ad
commit e91baa3ae5
2 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -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"