Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .local/bin/statusbar/sb-forecast
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
3 changes: 2 additions & 1 deletion .local/bin/statusbar/sb-iplocate
Original file line number Diff line number Diff line change
Expand Up @@ -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/;.*//"
2 changes: 1 addition & 1 deletion .local/bin/statusbar/sb-moonphase
Original file line number Diff line number Diff line change
Expand Up @@ -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")"

Expand Down
21 changes: 16 additions & 5 deletions .local/bin/statusbar/sb-price
Original file line number Diff line number Diff line change
Expand Up @@ -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')" ] &&
Expand All @@ -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="$" ;;
Expand Down