dotfiles/.local/scripts/bbr/0010_300_weather

23 lines
385 B
Plaintext
Raw Normal View History

2022-10-03 02:06:02 +08:00
#!/bin/bash
2023-03-08 20:06:00 +08:00
CITY="auto"
2022-10-03 02:06:02 +08:00
COLOR1="#AAAAAA"
COLOR2="#444444"
2023-03-08 20:12:41 +08:00
if [ $CITY = "auto" ]
2023-03-08 20:06:00 +08:00
then
2023-03-08 20:12:41 +08:00
CITY="@$(curl -s zx2c4.com/ip | head -1)"
2023-03-08 20:06:00 +08:00
fi
icon=$(curl -s "wttr.in/$CITY?format=%C")
2022-10-03 02:06:02 +08:00
icon=$(echo $icon | tr -d ' ')
temp=$(curl -s "wttr.in/$CITY?format=%t")
wind=$(curl -s "wttr.in/$CITY?format=%w")
2023-03-08 20:06:00 +08:00
echo "^b$COLOR2^^c$COLOR1^ ^b$COLOR1^^c$COLOR2^ $icon ^c$COLOR1^^b$COLOR2^ $temp ^d^"