i can just look outside

This commit is contained in:
2026-09-23 02:06:29 +05:00
parent 37eef2a11b
commit 18a226042e
3 changed files with 0 additions and 43 deletions
-26
View File
@@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Get weather data from wttr.in with geolocation from ipinfo.io
# You can override with WEATHER_LOCATION environment variable
LOCATION="${WEATHER_LOCATION:-}"
# If no location is set, fetch it from ipinfo.io
if [ -z "$LOCATION" ]; then
LOCATION=$(curl -s "https://ipinfo.io/" | jq -r '.city // empty')
fi
# Fetch weather using wttr.in
if [ -n "$LOCATION" ]; then
WEATHER_DATA=$(curl -s "wttr.in/$LOCATION?format=%c+%t")
TOOLTIP=$(curl -s "wttr.in/$LOCATION?format=%l:+%c+%t+%w+%p+%h")
else
WEATHER_DATA=$(curl -s "wttr.in/?format=%c+%t")
TOOLTIP=$(curl -s "wttr.in/?format=%l:+%c+%t+%w+%p+%h")
fi
# Check if curl was successful
if [ $? -eq 0 ] && [ -n "$WEATHER_DATA" ]; then
echo "{\"text\":\"$WEATHER_DATA\", \"tooltip\":\"$TOOLTIP\"}"
else
echo "{\"text\":\"🌡 N/A\", \"tooltip\":\"Weather data unavailable\"}"
fi