From a438e92778d281e30ce1e59de2cc434361452358 Mon Sep 17 00:00:00 2001 From: "M.Zeinali" Date: Thu, 16 Sep 2021 23:56:20 +0430 Subject: [PATCH] Get the location based on the ip from freegeoip If LOCATION is not set get the location based on the ip from freegeoip --- .local/bin/statusbar/sb-forecast | 1 + 1 file changed, 1 insertion(+) diff --git a/.local/bin/statusbar/sb-forecast b/.local/bin/statusbar/sb-forecast index 7b8416ec..d7e279aa 100755 --- a/.local/bin/statusbar/sb-forecast +++ b/.local/bin/statusbar/sb-forecast @@ -7,6 +7,7 @@ # 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. weatherreport="${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" +[ -z "$LOCATION" ] && LOCATION="$(curl -s https://freegeoip.app/json/ | jq .city)" getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1 ;} # Some very particular and terse stream manipulation. We get the maximum