diff --git a/de/home/.config/eww/modules/widgets/weather.yuck b/de/home/.config/eww/modules/widgets/weather.yuck index 408146f..3bc4bfa 100644 --- a/de/home/.config/eww/modules/widgets/weather.yuck +++ b/de/home/.config/eww/modules/widgets/weather.yuck @@ -1,4 +1,5 @@ -(defpoll weather_status :interval "3600s" +(defpoll weather_status :initial "{}" + :interval "3600s" 'scripts/widgets/weather') (defwidget weather [json] (box @@ -7,7 +8,8 @@ :width 300 :height 125 :space-evenly true - "Eugene, OR | ${json.current_condition[0].weatherDesc[0].value}" - "${json.current_condition[0].temp_F}°F (feels like ${json.current_condition[0].FeelsLikeF}°F)" - "${json.weather[0].mintempF}°F / ${json.weather[0].maxtempF}°F" - "${json.current_condition[0].humidity}% humidity")) + "Eugene, OR | ${json.condition}" + "${json.current_temp}°F (feels like ${json.feels_temp}°F)" + "${json.min_temp}°F / ${json.max_temp}°F" + "${json.humidity}% humidity" + "Updated: ${json.updated}")) diff --git a/de/home/.config/eww/scripts/widgets/weather b/de/home/.config/eww/scripts/widgets/weather index 5bcbe50..d81841e 100755 --- a/de/home/.config/eww/scripts/widgets/weather +++ b/de/home/.config/eww/scripts/widgets/weather @@ -9,4 +9,14 @@ if [[ ! $(find "${wttr_cache}" -cmin -60 -print 2>/dev/null) ]]; then curl --silent wttr.in/Eugene?format=j1 > "${wttr_cache}" fi -cat "${wttr_cache}" +#cat "${wttr_cache}" + +condition="$(jq -r '.current_condition[0].weatherDesc[0].value' /home/penelope/.cache/wttr.json)" +current_temp="$(jq -r '.current_condition[0].temp_F' /home/penelope/.cache/wttr.json)" +feels_temp="$(jq -r '.current_condition[0].FeelsLikeF' /home/penelope/.cache/wttr.json)" +min_temp="$(jq -r '.weather[0].mintempF' /home/penelope/.cache/wttr.json)" +max_temp="$(jq -r '.weather[0].maxtempF' /home/penelope/.cache/wttr.json)" +humidity="$(jq -r '.current_condition[0].humidity' /home/penelope/.cache/wttr.json)" +updated="$(date -r ${wttr_cache} '+%B %d, %Y at %H:%M')" + +jq -n --arg condition "${condition}" --arg current_temp "${current_temp}" --arg feels_temp "${feels_temp}" --arg min_temp "${min_temp}" --arg max_temp "${max_temp}" --arg humidity "${humidity}" --arg updated "${updated}" '{condition: $condition,current_temp: $current_temp,feels_temp: $feels_temp,min_temp: $min_temp,max_temp: $max_temp,humidity: $humidity,updated: $updated}'