mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-01-30 09:48:11 +01:00
Allow dwmblocks signal numbers to be changed
This commit is contained in:
parent
060c093deb
commit
0e237592d7
@ -48,4 +48,4 @@ case $BLOCK_BUTTON in
|
|||||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
checkforecast && showweather || { ( getforecast && pkill -RTMIN+5 "${STATUSBAR:-dwmblocks}") & echo; }
|
checkforecast && showweather || { ( getforecast && pkill -RTMIN+"${1:-5}" "${STATUSBAR:-dwmblocks}") & echo; }
|
||||||
|
|||||||
@ -7,5 +7,5 @@
|
|||||||
|
|
||||||
ifinstalled "geoip" || exit
|
ifinstalled "geoip" || exit
|
||||||
ipfile="$XDG_RUNTIME_DIR/iplocate"
|
ipfile="$XDG_RUNTIME_DIR/iplocate"
|
||||||
addr=$(cat "$ipfile") && rm "$ipfile" || { ( curl -s ifconfig.me > "$ipfile" && pkill -RTMIN+27 "${STATUSBAR:-dwmblocks}") & echo; exit; }
|
addr=$(cat "$ipfile") && rm "$ipfile" || { ( curl -s ifconfig.me > "$ipfile" && pkill -RTMIN+"${1:-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" && pkill -RTMIN+17 "${STATUSBAR:-dwmblocks}" ) & echo; exit; }
|
{ ( curl -sf "wttr.in/?format=%m" > "$moonfile" && pkill -RTMIN+"${1:-17}" "${STATUSBAR:-dwmblocks}" ) & echo; exit; }
|
||||||
|
|
||||||
icon="$(cat "$moonfile")"
|
icon="$(cat "$moonfile")"
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Usage:
|
# Usage:
|
||||||
# price <url> <Name of currency> <icon> <Price to show in>
|
# price <dwmblocks signal> <url> <Name of currency> <icon> <Price to show in>
|
||||||
# price bat "Basic Attention Token" 🦁
|
# price 20 bat "Basic Attention Token" 🦁
|
||||||
# When the name of the currency is multi-word, put it in quotes.
|
# When the name of the currency is multi-word, put it in quotes.
|
||||||
|
|
||||||
[ -z "$3" ] && exit 1
|
[ -z "$4" ] && exit 1
|
||||||
|
|
||||||
# use $4 as currency, if not passed in use "usd" as default
|
# use $5 as currency, if not passed in use "usd" as default
|
||||||
url="${CRYPTOURL:-rate.sx}"
|
url="${CRYPTOURL:-rate.sx}"
|
||||||
currency="${4:-usd}"
|
currency="${5:-usd}"
|
||||||
interval="@14d" # History contained in chart preceded by '@' (7d = 7 days)
|
interval="@14d" # History contained in chart preceded by '@' (7d = 7 days)
|
||||||
dir="${XDG_CACHE_HOME:-$HOME/.cache}/crypto-prices"
|
dir="${XDG_CACHE_HOME:-$HOME/.cache}/crypto-prices"
|
||||||
pricefile="$dir/$1-$currency"
|
pricefile="$dir/$2-$currency"
|
||||||
chartfile="$dir/$1-$currency-chart"
|
chartfile="$dir/$2-$currency-chart"
|
||||||
filestat="$(stat -c %x "$pricefile" 2>/dev/null)"
|
filestat="$(stat -c %x "$pricefile" 2>/dev/null)"
|
||||||
|
|
||||||
[ -d "$dir" ] || mkdir -p "$dir"
|
[ -d "$dir" ] || mkdir -p "$dir"
|
||||||
@ -26,9 +26,9 @@ updateprice() { curl -sf $currency.$url/{1$1,$1$interval} --output "$pricefile"
|
|||||||
|
|
||||||
case $BLOCK_BUTTON in
|
case $BLOCK_BUTTON in
|
||||||
1) setsid "$TERMINAL" -e less -Srf "$chartfile" ;;
|
1) setsid "$TERMINAL" -e less -Srf "$chartfile" ;;
|
||||||
2) notify-send -u low "$3 Updating..." "Updating $2 price..." ; updateme="1" ; showupdate="1" ;;
|
2) notify-send -u low "$4 Updating..." "Updating $3 price..." ; updateme="1" ; showupdate="1" ;;
|
||||||
3) uptime="$(date -d "$filestat" '+%D at %T' | sed "s|$(date '+%D')|Today|")"
|
3) uptime="$(date -d "$filestat" '+%D at %T' | sed "s|$(date '+%D')|Today|")"
|
||||||
notify-send "$3 $2 module" "\- <b>Exact price: \$$(cat "$pricefile")</b>
|
notify-send "$4 $3 module" "\- <b>Exact price: \$$(cat "$pricefile")</b>
|
||||||
- Left click for chart of changes.
|
- Left click for chart of changes.
|
||||||
- Middle click to update.
|
- Middle click to update.
|
||||||
- Shows 🔃 if updating prices.
|
- Shows 🔃 if updating prices.
|
||||||
@ -39,19 +39,9 @@ esac
|
|||||||
|
|
||||||
[ -n "$updateme" ] &&
|
[ -n "$updateme" ] &&
|
||||||
if [ -n "$showupdate" ]; then
|
if [ -n "$showupdate" ]; then
|
||||||
updateprice "$1" && notify-send "$3 Update complete." "$2 price is now \$$(cat "$pricefile")"
|
updateprice "$2" && notify-send "$4 Update complete." "$3 price is now \$$(cat "$pricefile")"
|
||||||
else
|
else
|
||||||
# get dwmblocks signal numbers corresponding to currency
|
( updateprice "$2" && pkill -RTMIN+"$1" "${STATUSBAR:-dwmblocks}") & echo; exit
|
||||||
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
|
fi
|
||||||
|
|
||||||
case "$currency" in
|
case "$currency" in
|
||||||
@ -61,4 +51,4 @@ case "$currency" in
|
|||||||
btc) symb="" ;;
|
btc) symb="" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[ -f "$pricefile" ] && printf "$3$symb%0.2f" "$(cat "$pricefile")"
|
[ -f "$pricefile" ] && printf "$4$symb%0.2f" "$(cat "$pricefile")"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user