From dd63a341c8dc5f15a8d4a39e06f2417789dfc1aa Mon Sep 17 00:00:00 2001 From: Penelope Gwen Date: Wed, 24 Apr 2024 15:00:02 -0600 Subject: [PATCH] New backup 2024-04-24 15:00:02 --- .../sway/scripts/global_shortcuts/weather | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/de/home/.config/sway/scripts/global_shortcuts/weather b/de/home/.config/sway/scripts/global_shortcuts/weather index dc4919e..894e4dc 100755 --- a/de/home/.config/sway/scripts/global_shortcuts/weather +++ b/de/home/.config/sway/scripts/global_shortcuts/weather @@ -17,17 +17,20 @@ 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} ) + hourly_forecast="${hourly_forecast}\n${check_hour}: "$( jq -r --argjson h ${h} '.weather.[0].hourly.[$h].weatherDesc.[].value' <<< ${jweather} )", "$( jq -r --argjson h ${h} '.weather.[0].hourly.[$h].FeelsLikeF' <<< ${jweather} )"°F" 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 - 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" + echo $d + daily_forecast="${daily_forecast}\n"$( date -d $( jq -r --argjson d ${d} '.weather.[$d].date' <<< ${jweather} ) +'%a' )": "$( jq -r --argjson d ${d} '.weather.[$d].hourly.[4].weatherDesc.[].value' <<< ${jweather} )" ("$( jq -r --argjson d ${d} '.weather.[$d].maxtempF' <<< ${jweather} )"°F/"$( jq -r --argjson d ${d} '.weather.[$d].mintempF' <<< ${jweather} )"°F)" done -forecast=$( echo -e $forecast ) # | sed '/^[[:space:]]*$/d' ) +hourly_forecast=$( echo -e $hourly_forecast | sed '/^[[:space:]]*$/d' ) +daily_forecast=$( echo -e $daily_forecast ) # | sed '/^[[:space:]]*$/d' ) -notify-send "${weather_desc}, ${current_f}°F -High: ${high_f}°F | Low: ${low_f}°F +echo $daily_forecast + +notify-send "${weather_desc}, ${current_f}°F (${high_f}°F/${low_f}°F) +${hourly_forecast} ${daily_forecast}"