Status bar fixes for nettraf and memory (#627)

* More precise RAM measurement and fix of memory type

* Should be KiB 

kB refers to
https://en.wikipedia.org/wiki/Kibibyte
This commit is contained in:
Vlad Doster 2020-05-10 06:58:09 -05:00 committed by GitHub
parent 6577acae89
commit 8f05c7d79f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -9,4 +9,4 @@ case $BLOCK_BUTTON in
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
free -h | sed -n '2{p;q}' | awk '{print "🧠", $3 "/" $2}' free --mebi | sed -n '2{p;q}' | awk '{printf ("🧠 %2.2fGiB/%2.2fGiB", ( $3 / 1024), ($2 / 1024))}'

View file

@ -16,7 +16,7 @@ txfile="${XDG_CACHE_HOME:-$HOME/.cache}/txlog"
rxcurrent="$(cat /sys/class/net/*/statistics/rx_bytes | paste -sd '+' | bc)" rxcurrent="$(cat /sys/class/net/*/statistics/rx_bytes | paste -sd '+' | bc)"
txcurrent="$(cat /sys/class/net/*/statistics/tx_bytes | paste -sd '+' | bc)" txcurrent="$(cat /sys/class/net/*/statistics/tx_bytes | paste -sd '+' | bc)"
printf "🔻%skB 🔺%skB\\n" \ printf "🔻%sKiB 🔺%sKiB\\n" \
"$(printf -- "(%s-%s)/1024\\n" "$rxcurrent" "$(cat "$rxfile")" | bc)" \ "$(printf -- "(%s-%s)/1024\\n" "$rxcurrent" "$(cat "$rxfile")" | bc)" \
"$(printf -- "(%s-%s)/1024\\n" "$txcurrent" "$(cat "$txfile")" | bc)" "$(printf -- "(%s-%s)/1024\\n" "$txcurrent" "$(cat "$txfile")" | bc)"