From 8561a3726dfafd574ed0e0a155282110e5917278 Mon Sep 17 00:00:00 2001 From: Penelope Gwen Date: Wed, 24 Apr 2024 14:30:03 -0600 Subject: [PATCH] New backup 2024-04-24 14:30:03 --- .../sway/scripts/global_shortcuts/weather | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/de/home/.config/sway/scripts/global_shortcuts/weather b/de/home/.config/sway/scripts/global_shortcuts/weather index aa367fb..dc4919e 100755 --- a/de/home/.config/sway/scripts/global_shortcuts/weather +++ b/de/home/.config/sway/scripts/global_shortcuts/weather @@ -7,13 +7,27 @@ current_f=$( jq -r '.current_condition.[].FeelsLikeF' <<< ${jweather} ) high_f=$( jq -r '.weather.[0].maxtempF' <<< ${jweather} ) low_f=$( jq -r '.weather.[0].mintempF' <<< ${jweather} ) weather_desc=$( jq -r '.current_condition.[].weatherDesc.[].value' <<< ${jweather} ) -forecast="" +hourly_forecast="" +daily_forecast="" + +current_hour=$( date +'%H' ) +echo $current_hour + +for h in {0..7};do + check_hour=$( date -d $( jq -r --argjson h ${h} '.weather.[0].hourly.[$h].time' <<< ${jweather} ) +'%H' ) + if [[ ${check_hour#0} -ge ${current_hour#0} ]];then + echo "future" + hourly_forecast="${hourly_forecast}\n${check_hour}"$( jq -r --argjson h ${h} '.weather.[0].hourly.[$h]..FeelsLikeF' <<< ${jweather} ) + fi +# hourly_forecast="${forecast}\n"$( date -d $( jq -r --argjson d ${d} '.weather.[$d].date' <<< ${jweather} ) +'%a' )": High "$( jq -r --argjson d ${d} '.weather.[$d].maxtempF' <<< ${jweather} )"°F, Low"$( jq -r --argjson d ${d} '.weather.[$d].mintempF' <<< ${jweather} )"°F" +done +exit for d in {1..2};do - forecast="${forecast}\n"$( date -d $( jq -r --argjson d ${d} '.weather.[$d].date' <<< ${jweather} ) +'%a' )": High "$( jq -r --argjson d ${d} '.weather.[$d].maxtempF' <<< ${jweather} )"°F, Low"$( jq -r --argjson d ${d} '.weather.[$d].mintempF' <<< ${jweather} )"°F" + daily_forecast="${forecast}\n"$( date -d $( jq -r --argjson d ${d} '.weather.[$d].date' <<< ${jweather} ) +'%a' )": High "$( jq -r --argjson d ${d} '.weather.[$d].maxtempF' <<< ${jweather} )"°F, Low"$( jq -r --argjson d ${d} '.weather.[$d].mintempF' <<< ${jweather} )"°F" done forecast=$( echo -e $forecast ) # | sed '/^[[:space:]]*$/d' ) notify-send "${weather_desc}, ${current_f}°F High: ${high_f}°F | Low: ${low_f}°F -${forecast}" +${daily_forecast}"