This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/sway/.config/waybar/custom/weather

32 lines
583 B
Plaintext
Raw Normal View History

2019-10-16 02:28:41 +02:00
#!/bin/sh
2019-12-01 17:36:00 +01:00
set -e
2019-10-16 02:28:41 +02:00
CITY=$(curl -s ipinfo.io/city)
APPID="fd68c0fe7951f5ab7e24a240eb0942b8"
OUTPUT=$(http get http://api.openweathermap.org/data/2.5/weather\?APPID\=${APPID}\&q\="${CITY}"\&units\=metric)
TEMP=$(echo $OUTPUT | jq -r ".main.temp")
WEATHER=$(echo $OUTPUT | jq -r ".weather[0].main")
case $WEATHER in
2019-12-01 17:36:00 +01:00
"Clear")
2019-10-16 02:28:41 +02:00
WEATHER=""
;;
2019-12-01 17:36:00 +01:00
"Clouds")
2019-10-16 02:28:41 +02:00
WEATHER=""
;;
2019-12-01 17:36:00 +01:00
"Rain"|"Drizzle")
2019-10-16 02:28:41 +02:00
WEATHER=""
;;
2019-12-01 17:36:00 +01:00
"Mist")
2019-11-23 18:35:46 +01:00
WEATHER=" "
;;
2019-12-01 17:36:00 +01:00
"Snow")
2019-10-16 02:28:41 +02:00
WEATHER=""
;;
2019-12-01 17:36:00 +01:00
"Thunderstorm")
2019-10-16 02:28:41 +02:00
WEATHER=""
;;
esac
echo "$TEMP°C $WEATHER"