dotfiles/.local/scripts/bbr/0010_300_weather

23 lines
513 B
Bash
Executable File

#!/bin/bash
CITY="auto"
COLOR1="#AAAAAA"
COLOR2="#444444"
if [ $CITY = "auto" ]
then
CITY="@$(curl -s zx2c4.com/ip | head -1)"
fi
icon=$(curl -s "wttr.in/$CITY?format=%C")
icon=$(echo $icon | tr -d ' ')
temp=$(curl -s "wttr.in/$CITY?format=%t")
wind=$(curl -s https://wttr.in/@178.23.190.182?format=j2 | python3 -c "import sys, json; print(json.load(sys.stdin)['current_condition'][0]['windspeedKmph'])")
echo "^b$COLOR2^^c$COLOR1^ $wind km/h ^b$COLOR1^^c$COLOR2^ $icon ^c$COLOR1^^b$COLOR2^ $temp ^d^"