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

59 lines
947 B
Plaintext
Raw Normal View History

2019-10-16 02:28:41 +02:00
#!/bin/sh
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)
# echo $APPID
# echo $OUTPUT
2019-10-17 05:44:35 +02:00
if [ $? -ne 0 ]
2019-10-17 00:42:00 +02:00
then
exit 1
fi
2019-10-16 02:28:41 +02:00
TEMP=$(echo $OUTPUT | jq -r ".main.temp")
WEATHER=$(echo $OUTPUT | jq -r ".weather[0].main")
case $WEATHER in
"Clear"*)
WEATHER=""
;;
"Clouds"*)
WEATHER=""
;;
"Rain"*)
WEATHER=""
;;
2019-11-23 18:35:46 +01:00
"Mist"*)
WEATHER=" "
;;
2019-10-16 02:28:41 +02:00
"Snow"*)
WEATHER=""
;;
"Thunderstorm"*)
WEATHER=""
;;
esac
# case $WEATHER in
# "Clear"*)
# WEATHER="Limpo :)"
# ;;
# "Clouds"*)
# WEATHER="Nublado :/"
# ;;
# "Rain"*)
# WEATHER="Chuva °~°"
# ;;
# "Snow"*)
# WEATHER="Neve ºUº"
# ;;
# "Thunderstorm"*)
# WEATHER="Tempestade *-*"
# ;;
# esac
echo "$TEMP°C $WEATHER"
#echo "$TEMP°C"