summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2018-05-14 09:01:37 -0700
committerGitHub <noreply@github.com>2018-05-14 09:01:37 -0700
commit85d40e82db9ce31adfd5071065830ebab45269bd (patch)
tree087ef9b61481999bb7e24c17cc885b094527e5fe
parentb223dbbeb4bcbd4550b9f009f0bc38a0449f2ce7 (diff)
parent8e5c11d79e46b973ca400e54eafb43082fe7e480 (diff)
downloadeibhear-85d40e82db9ce31adfd5071065830ebab45269bd.tar.gz
eibhear-85d40e82db9ce31adfd5071065830ebab45269bd.tar.zst
eibhear-85d40e82db9ce31adfd5071065830ebab45269bd.zip
Merge pull request #49 from Daenarii/patch-1
Fix i3weather blank location bug
-rwxr-xr-x.scripts/i3weather12
1 files changed, 7 insertions, 5 deletions
diff --git a/.scripts/i3weather b/.scripts/i3weather
index d5112cc..3000b8a 100755
--- a/.scripts/i3weather
+++ b/.scripts/i3weather
@@ -1,14 +1,16 @@
#!/bin/bash
+### This is only if your location isn't automatically detected, otherwise you can leave it blank.
+location=""
[[ $BLOCK_BUTTON = "1" ]] && st -e w3m wttr.in
ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` >/dev/null || exit
-### This is only if your location isn't automatically detected, otherwise you can leave it blank.
-loc=""
-location=${loc// /+}
-
-curl wttr.in/~$location > ~/.weatherreport
+if [[ "$location" != "" ]]
+ then
+ location="~${location// /+}"
+fi
+curl -s wttr.in/$location > ~/.weatherreport
echo -n ☔ $(cat ~/.weatherreport | sed -n 16p | sed -e 's/[^m]*m//g' | grep -o "[0-9]*%" | sort -n | sed -e '$!d')