From 0d46dc5e037220095cf5eb9a5999a5f025299b78 Mon Sep 17 00:00:00 2001 From: kubetz Date: Sun, 16 Sep 2018 03:56:27 +0200 Subject: [PATCH] Reposition ping and add failsafe tail --- .scripts/i3weather | 4 ++-- 1 file 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')"