diff --git a/.local/bin/statusbar/sb-forecast b/.local/bin/statusbar/sb-forecast index 2b41b3d7..582af2b5 100755 --- a/.local/bin/statusbar/sb-forecast +++ b/.local/bin/statusbar/sb-forecast @@ -48,6 +48,4 @@ case $BLOCK_BUTTON in 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac -checkforecast || getforecast - -showweather +checkforecast && showweather || { ( getforecast && pkill -RTMIN+5 "${STATUSBAR:-dwmblocks}") & echo; } diff --git a/.local/bin/statusbar/sb-iplocate b/.local/bin/statusbar/sb-iplocate index 02adab8d..a6eb76fc 100755 --- a/.local/bin/statusbar/sb-iplocate +++ b/.local/bin/statusbar/sb-iplocate @@ -6,5 +6,6 @@ # https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/ ifinstalled "geoip" || exit -addr="$(curl ifconfig.me 2>/dev/null)" || exit +ipfile="$XDG_RUNTIME_DIR/iplocate" +addr=$(cat "$ipfile") && rm "$ipfile" || { ( curl -s ifconfig.me > "$ipfile" && pkill -RTMIN+27 "${STATUSBAR:-dwmblocks}") & echo; exit; } grep "flag: " "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji" | grep "$(geoiplookup "$addr" | sed 's/.*, //')" | sed "s/flag: //;s/;.*//" diff --git a/.local/bin/statusbar/sb-moonphase b/.local/bin/statusbar/sb-moonphase index 99adaee8..7b939feb 100755 --- a/.local/bin/statusbar/sb-moonphase +++ b/.local/bin/statusbar/sb-moonphase @@ -5,7 +5,7 @@ moonfile="${XDG_DATA_HOME:-$HOME/.local/share}/moonphase" [ -s "$moonfile" ] && [ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || - { curl -sf "wttr.in/?format=%m" > "$moonfile" || exit 1 ;} + { ( curl -sf "wttr.in/?format=%m" > "$moonfile" && pkill -RTMIN+17 "${STATUSBAR:-dwmblocks}" ) & echo; exit; } icon="$(cat "$moonfile")" diff --git a/.local/bin/statusbar/sb-price b/.local/bin/statusbar/sb-price index 9dc2d527..7304de8f 100755 --- a/.local/bin/statusbar/sb-price +++ b/.local/bin/statusbar/sb-price @@ -18,7 +18,7 @@ filestat="$(stat -c %x "$pricefile" 2>/dev/null)" [ -d "$dir" ] || mkdir -p "$dir" -updateprice() { curl -sf -m 1 --fail-early $currency.$url/{1$1,$1$interval} --output "$pricefile" --output "$chartfile" || +updateprice() { curl -sf $currency.$url/{1$1,$1$interval} --output "$pricefile" --output "$chartfile" || rm -f "$pricefile" "$chartfile" ;} [ "${filestat%% *}" != "$(date '+%Y-%m-%d')" ] && @@ -38,10 +38,21 @@ case $BLOCK_BUTTON in esac [ -n "$updateme" ] && - updateprice "$1" && - [ -n "$showupdate" ] && - notify-send "$3 Update complete." "$2 price is now -\$$(cat "$pricefile")" + if [ -n "$showupdate" ]; then + updateprice "$1" && notify-send "$3 Update complete." "$2 price is now \$$(cat "$pricefile")" + else + # get dwmblocks signal numbers corresponding to currency + case "$1" in + lbc) sig="22" ;; + bat) sig="20" ;; + link) sig="25" ;; + xmr) sig="24" ;; + eth) sig="23" ;; + btc) sig="21" ;; + esac + + ( updateprice "$1" && pkill -RTMIN+"$sig" "${STATUSBAR:-dwmblocks}") & echo; exit + fi case "$currency" in usd) symb="$" ;;