From 8f05c7d79f91783d2cafe00a7d479eef9d652e8a Mon Sep 17 00:00:00 2001 From: Vlad Doster Date: Sun, 10 May 2020 06:58:09 -0500 Subject: [PATCH] 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 --- .local/bin/statusbar/memory | 2 +- .local/bin/statusbar/nettraf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.local/bin/statusbar/memory b/.local/bin/statusbar/memory index 66fcd8b..0d64508 100755 --- a/.local/bin/statusbar/memory +++ b/.local/bin/statusbar/memory @@ -9,4 +9,4 @@ case $BLOCK_BUTTON in 6) "$TERMINAL" -e "$EDITOR" "$0" ;; 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))}' diff --git a/.local/bin/statusbar/nettraf b/.local/bin/statusbar/nettraf index d96d979..3c41dfc 100755 --- a/.local/bin/statusbar/nettraf +++ b/.local/bin/statusbar/nettraf @@ -16,7 +16,7 @@ txfile="${XDG_CACHE_HOME:-$HOME/.cache}/txlog" rxcurrent="$(cat /sys/class/net/*/statistics/rx_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" "$txcurrent" "$(cat "$txfile")" | bc)"