diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-03-30 17:37:27 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-03-30 17:37:27 +0900 |
| commit | 7b7a0182db07101693165d6dbb531ee7cc79bb01 (patch) | |
| tree | ebe662840499b4d45d82c9f4067c8fb34d03a415 /ar/.local/bin/statusbar | |
| parent | 7eac35b13b3da00caa46ed79beba6866da5ae716 (diff) | |
modified statusbar/sb-forecast
Diffstat (limited to 'ar/.local/bin/statusbar')
| -rwxr-xr-x | ar/.local/bin/statusbar/sb-forecast | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/ar/.local/bin/statusbar/sb-forecast b/ar/.local/bin/statusbar/sb-forecast index 6d9b086..e24ee36 100755 --- a/ar/.local/bin/statusbar/sb-forecast +++ b/ar/.local/bin/statusbar/sb-forecast @@ -34,19 +34,11 @@ getweatherreportjson() { echo "$tmp" >"$weatherreportjson" } -# Generate a text report from JSON data and save it locally. +# Fetch a text weather report from wttr.in and save it locally. getweatherreport() { - { - printf "🌈 Today's weather: %s\n" "$(getdesc)" - printf "🏂: %s%%\n" "$(getsnow)" - printf "☔: %s%% (day high: %s%%)\n" "$(getprecip)" "$(gethighprecip)" - gethumidity - printf "🎐: %s km/h\n" "$(getwind)" - printf "🌞: %s°C (feels like %s°C)\n" "$(gettemp)" "$(getfeelslike)" - printf "🥶: %s°C\n" "$(getlowtemp)" - printf "🥵: %s°C\n" "$(gethightemp)" - printf "\nUpdated: %s\n" "$(date '+%Y-%m-%d %H:%M:%S')" - } >"$weatherreport" + url="${WTTRURL:-wttr.in}" + tmp=$(timeout --signal=1 2s curl -sf "$url/${LOCATION:-$location}") || error "weatherreport" + echo "$tmp" >"$weatherreport" } # Forecast should be updated every 3 hours, but set 86400 to check once a day for reliability. |
