From bc553f06be4635ad24ee3cc499523050a4ed389d Mon Sep 17 00:00:00 2001 From: narukeh Date: Fri, 5 Mar 2021 15:43:44 +0100 Subject: [PATCH] fix sb-forecast --- .local/bin/statusbar/sb-forecast | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.local/bin/statusbar/sb-forecast b/.local/bin/statusbar/sb-forecast index 6652edd..1c9c0ff 100755 --- a/.local/bin/statusbar/sb-forecast +++ b/.local/bin/statusbar/sb-forecast @@ -6,6 +6,7 @@ # If we have internet, get a weather report from wttr.in and store it locally. # You could set up a shell alias to view the full file in a pager in the # terminal if desired. This function will only be run once a day when needed. +LOCATION='' weatherreport="${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1 ;} @@ -14,7 +15,7 @@ getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1 ;} # display them with coresponding emojis. showweather() { printf "%s" "$(sed '16q;d' "$weatherreport" | grep -wo "[0-9]*%" | sort -rn | sed "s/^/☔/g;1q" | tr -d '\n')" -sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " 🥶" $1 "°","🌞" $2 "°"}' ;} +sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " 🥶" $1 "°","🌞" $2 "°"}' ;} case $BLOCK_BUTTON in 1) setsid -f "$TERMINAL" -e less -Srf "$weatherreport" ;;