summaryrefslogtreecommitdiffstats
path: root/.local/bin/statusbar
diff options
context:
space:
mode:
authorjamazi <31401744+jamazi@users.noreply.github.com>2020-07-02 17:59:54 +0300
committerGitHub <noreply@github.com>2020-07-02 10:59:54 -0400
commitf11008c619e1746d0d3f25c471343c1591200941 (patch)
treef0aa0b9fbb99ed3112f8ffb0463d1f40d9019207 /.local/bin/statusbar
parentbe9490155fae85a877d49c7342a8814a184c414d (diff)
downloadeibhear-f11008c619e1746d0d3f25c471343c1591200941.tar.gz
eibhear-f11008c619e1746d0d3f25c471343c1591200941.tar.zst
eibhear-f11008c619e1746d0d3f25c471343c1591200941.zip
improve speed format (#738)
* improve speed format Convert network speed into human-readable format using numfmt, this will handle low and high values properly. * Update nettraf fix jitter
Diffstat (limited to '.local/bin/statusbar')
-rwxr-xr-x.local/bin/statusbar/nettraf4
1 files changed, 2 insertions, 2 deletions
diff --git a/.local/bin/statusbar/nettraf b/.local/bin/statusbar/nettraf
index ac43416..af61d5a 100755
--- a/.local/bin/statusbar/nettraf
+++ b/.local/bin/statusbar/nettraf
@@ -19,10 +19,10 @@ update() {
cache=${XDG_CACHE_HOME:-$HOME/.cache}/${1##*/}
[ -f "$cache" ] && read -r old < "$cache" || old=0
printf %d\\n "$sum" > "$cache"
- printf %d\\n $(( (sum - old) / 1024 ))
+ printf %d\\n $(( sum - old ))
}
rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes)
-printf "🔻%dKiB 🔺%dKiB\\n" "$rx" "$tx"
+printf "🔻%4sB 🔺%4sB\\n" $(numfmt --to=iec $rx) $(numfmt --to=iec-i $tx)