mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-01-30 09:48:11 +01: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" ;;
|
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
checkforecast || getforecast
|
checkforecast && showweather || { ( getforecast && pkill -RTMIN+5 "${STATUSBAR:-dwmblocks}") & echo; }
|
||||||
|
|
||||||
showweather
|
|
||||||
|
|||||||
@ -6,5 +6,6 @@
|
|||||||
# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/
|
# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/
|
||||||
|
|
||||||
ifinstalled "geoip" || exit
|
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/;.*//"
|
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"
|
moonfile="${XDG_DATA_HOME:-$HOME/.local/share}/moonphase"
|
||||||
|
|
||||||
[ -s "$moonfile" ] && [ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
|
[ -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")"
|
icon="$(cat "$moonfile")"
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ filestat="$(stat -c %x "$pricefile" 2>/dev/null)"
|
|||||||
|
|
||||||
[ -d "$dir" ] || mkdir -p "$dir"
|
[ -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" ;}
|
rm -f "$pricefile" "$chartfile" ;}
|
||||||
|
|
||||||
[ "${filestat%% *}" != "$(date '+%Y-%m-%d')" ] &&
|
[ "${filestat%% *}" != "$(date '+%Y-%m-%d')" ] &&
|
||||||
@ -38,10 +38,21 @@ case $BLOCK_BUTTON in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
[ -n "$updateme" ] &&
|
[ -n "$updateme" ] &&
|
||||||
updateprice "$1" &&
|
if [ -n "$showupdate" ]; then
|
||||||
[ -n "$showupdate" ] &&
|
updateprice "$1" && notify-send "$3 Update complete." "$2 price is now \$$(cat "$pricefile")"
|
||||||
notify-send "$3 Update complete." "$2 price is now
|
else
|
||||||
\$$(cat "$pricefile")"
|
# 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
|
case "$currency" in
|
||||||
usd) symb="$" ;;
|
usd) symb="$" ;;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user