Files
scripts-bash/waybar/scripts/weather.sh
2026-03-30 15:48:25 -06:00

16 lines
540 B
Bash
Executable File

#!/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