Added obelisk status module

This commit is contained in:
Joachim Nielandt 2020-07-15 15:30:25 +02:00
parent e343db3f5e
commit f3c10b52d5
3 changed files with 28 additions and 1 deletions

View File

@ -100,7 +100,7 @@ monitor = ${env:MONITOR:eDP-1}
;border-right-size = 16
;unused modules - mpd xbacklight backlight-acpi alsa
modules-left = i3
modules-center = temperature battery xkeyboard memory cpu filesystem updates-arch reboot-check xbacklight top-process
modules-center = temperature battery xkeyboard memory cpu filesystem updates-arch reboot-check xbacklight top-process obelisk-status
modules-right = net wifi0 vpn powermenu
; TRAY MANAGEMENT
@ -150,6 +150,12 @@ format-prefix-foreground = ${colors.bright_green}
exec = ~/.config/polybar/polybar-scripts/polybar-scripts/info-hackspeed/info-hackspeed.sh
tail = true
[module/obelisk-status]
type = custom/script
exec = ~/scripts/obelisk.status.sh
tail = false
interval = 10
[module/top-process]
type = custom/script
format-prefix = " "

0
scripts/.keep Normal file
View File

View File

@ -0,0 +1,21 @@
#!/bin/bash
STATUSURL=https://obelisk.ilabt.imec.be/api/v2/status
STATUS=$(curl -s $STATUSURL | jq -r '.status')
# colors
HEALTHY="#b8bb26"
DEGRADED="#fe8019"
FAILED="#fb4934"
UNKNOWN="#928374"
# echo the status in polybar format
# the {F}x{F-} syntax allows you to color stuff
if [ $STATUS = "healthy" ]; then
echo "%{F$HEALTHY} %{F-} obelisk"
elif [ $STATUS = "degraded" ]; then
echo "%{F$DEGRADED} %{F-} obelisk"
elif [ $STATUS = "failed" ]; then
echo "%{F$FAILED} %{F-} obelisk"
else
echo "%{F$UNKNOWN} %{F-} obelisk"
fi