summaryrefslogtreecommitdiffstats
path: root/.scripts/i3weather
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2018-09-15 23:50:24 -0400
committerGitHub <noreply@github.com>2018-09-15 23:50:24 -0400
commit8e81c30a5d4284aec0542ab36712f8d8b3dc1e2c (patch)
tree44bd9c9605928cb374cfb6a4aed7436a498a37eb /.scripts/i3weather
parentbef4105562aa8fa396a2c2f76fa29994692b562d (diff)
parent0d46dc5e037220095cf5eb9a5999a5f025299b78 (diff)
downloadeibhear-8e81c30a5d4284aec0542ab36712f8d8b3dc1e2c.tar.gz
eibhear-8e81c30a5d4284aec0542ab36712f8d8b3dc1e2c.tar.zst
eibhear-8e81c30a5d4284aec0542ab36712f8d8b3dc1e2c.zip
Merge pull request #114 from kubetz/i3weather
Reposition ping and add failsafe tail
Diffstat (limited to '.scripts/i3weather')
-rwxr-xr-x.scripts/i3weather4
1 files changed, 2 insertions, 2 deletions
diff --git a/.scripts/i3weather b/.scripts/i3weather
index 8885fe4..d0a09cd 100755
--- a/.scripts/i3weather
+++ b/.scripts/i3weather
@@ -6,9 +6,9 @@ location=""
[ "$BLOCK_BUTTON" = "1" ] && $TERMINAL -e popweather
-curl -s wttr.in/$location > ~/.weatherreport
+ping -q -w 1 -c 1 "$(ip r | grep default | tail -1 | cut -d ' ' -f 3)" >/dev/null || exit
-ping -q -w 1 -c 1 "$(ip r | grep default | cut -d ' ' -f 3)" >/dev/null || exit
+curl -s wttr.in/$location > ~/.weatherreport
printf "%s" "$(sed '16q;d' ~/.weatherreport | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g" | tr -d '\n')"