Shorten ticker values in i3block

This commit is contained in:
2021-04-26 12:43:16 -04:00
parent 5c6f1e9a1c
commit 505f63a32d
4 changed files with 31 additions and 9 deletions

View File

@@ -85,13 +85,15 @@ for symbol in $(IFS=' '; echo "${SYMBOLS[*]}" | tr '[:lower:]' '[:upper:]'); do
# echo $price
hour=$(date +"%H")
if [[ "$symbol" == "USDCAD=X" ]]; then
printf "%0.4f\n" $price
elif [[ "$symbol" == "ADA"* ]]; then
printf "%0.3f\n" $price
elif (( $(echo "$price > 10000" | bc -l) )); then
printf "%'0.0f\n" "$price"
printf "%0.4f\n" "$price"
elif [[ "$symbol" == "BTC-USD" || "$symbol" == "ETH-USD" ]]; then
echo "$price" | cut -c 1-3
elif (( $(echo "$price > 1000" | bc -l) )); then
printf "%'0.0f\n" "$price" | cut -c 2-5
# elif (( $(echo "$price < 1" | bc -l) )); then
# printf "%0.3f\n" "$price"
else
printf "%0.2f\n" $price
printf "%0.2f\n" "$price" | cut -c 3-
fi
fi
done