mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2025-10-07 07:22:36 +02:00
Make dwmblocks modules async
This commit is contained in:
parent
5a6c56d565
commit
d1054d839e
@ -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; }
|
||||
|
||||
@ -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/;.*//"
|
||||
|
||||
@ -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")"
|
||||
|
||||
|
||||
@ -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="$" ;;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user