first commit
This commit is contained in:
15
waybar/scripts/weather.sh
Executable file
15
waybar/scripts/weather.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
API_KEY="bc07f366f9c10599a7700f80cc66e0d6"
|
||||
CITY_ID="3583361" # Puedes encontrarlo en https://openweathermap.org/find?q=San+Salvador
|
||||
UNITS="metric" # o "imperial" para Fahrenheit
|
||||
|
||||
WEATHER=$(curl -sf "https://api.openweathermap.org/data/2.5/weather?id=${CITY_ID}&appid=${API_KEY}&units=${UNITS}")
|
||||
|
||||
if [ "$WEATHER" != "" ]; then
|
||||
TEMP=$(echo "$WEATHER" | jq '.main.temp' | cut -d "." -f 1)
|
||||
ICON=$(echo "$WEATHER" | jq -r '.weather[0].icon')
|
||||
echo ".: ${TEMP} :."
|
||||
else
|
||||
echo ".: Weather unavailable :."
|
||||
fi
|
||||
Reference in New Issue
Block a user