From 9e27c7a4ac117120805912f4fbd820bde9f94fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E5=92=8C=E3=81=A7=E3=81=AA=E3=82=8A?= Date: Mon, 14 May 2018 20:37:32 +0800 Subject: [PATCH 1/2] Fix i3weather blank location bug --- .scripts/i3weather | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.scripts/i3weather b/.scripts/i3weather index d5112cc..0f98b35 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 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') From 8e5c11d79e46b973ca400e54eafb43082fe7e480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E5=92=8C=E3=81=A7=E3=81=AA=E3=82=8A?= Date: Mon, 14 May 2018 21:18:37 +0800 Subject: [PATCH 2/2] Update i3weather --- .scripts/i3weather | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scripts/i3weather b/.scripts/i3weather index 0f98b35..3000b8a 100755 --- a/.scripts/i3weather +++ b/.scripts/i3weather @@ -10,7 +10,7 @@ if [[ "$location" != "" ]] then location="~${location// /+}" fi -curl wttr.in/$location > ~/.weatherreport +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')