polybar: display climate info from netatmo
parent
e07aaedfef
commit
da08d33ed1
|
@ -57,7 +57,7 @@ font-1 = JetBrainsMono NerdFont;2
|
|||
|
||||
modules-left = bspwm xwindow
|
||||
modules-center = date
|
||||
modules-right = real eth pulseaudio xkeyboard memory cpu
|
||||
modules-right = real netatmo eth pulseaudio xkeyboard memory cpu
|
||||
cursor-click = pointer
|
||||
cursor-scroll = ns-resize
|
||||
|
||||
|
@ -253,6 +253,13 @@ format-prefix-foreground = ${colors.primary}
|
|||
|
||||
exec = ~/.config/polybar/scripts/real.sh
|
||||
|
||||
[module/netatmo]
|
||||
type = custom/script
|
||||
|
||||
interval = 900
|
||||
|
||||
exec = ~/.config/polybar/scripts/netatmo.sh
|
||||
|
||||
[settings]
|
||||
screenchange-reload = true
|
||||
pseudo-transparency = false
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
|
||||
# this script requires for https://github.com/deletescape/netatmo to be installed and set up
|
||||
|
||||
data_indoor="$(~/go/bin/netatmo json -i)"
|
||||
data_outdoor="$(~/go/bin/netatmo json -o)"
|
||||
|
||||
temp_outdoor="$(jq .Temperature <<< "$data_outdoor")"
|
||||
temp_indoor="$(jq .Temperature <<< "$data_indoor")"
|
||||
co2="$(jq .CO2 <<< "$data_indoor")"
|
||||
|
||||
echo -n "%{F#cba6f7}﨎%{F-} $temp_indoor/$temp_outdoor"
|
||||
|
||||
if [ "$co2" -gt "700" ]; then
|
||||
echo -n " %{F#cba6f7}ﳢ%{F-} "
|
||||
if [ "$co2" -gt "2000" ]; then
|
||||
echo "%{F#f38ba8}$co2%{F-}"
|
||||
dunstify -u critical "netatmo" "indoor co2 level is at $co2"
|
||||
elif [ "$co2" -gt "1000" ]; then
|
||||
echo "%{F#eba0ac}$co2%{F-}"
|
||||
dunstify -u normal "netatmo" "indoor co2 level is at $co2"
|
||||
else
|
||||
echo "$co2"
|
||||
fi
|
||||
fi
|
Loading…
Reference in New Issue