From 6d77cfe9e4bfb8cb6cf0b0a7aa11bb316f1fed33 Mon Sep 17 00:00:00 2001 From: dcarrillo Date: Fri, 12 Jun 2020 17:04:40 +0200 Subject: [PATCH] [polybar] Fix network_usage output --- .config/polybar/scripts/network_usage | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.config/polybar/scripts/network_usage b/.config/polybar/scripts/network_usage index 3c74579..b417aae 100755 --- a/.config/polybar/scripts/network_usage +++ b/.config/polybar/scripts/network_usage @@ -47,7 +47,12 @@ while true; do bits_in=$((((current_bytes_in-last_value_in) / REFRESH) * 8)) bits_out=$((((current_bytes_out-last_value_out) / REFRESH) * 8)) - output=$(numfmt --to iec --format "%8.2f" -z "$bits_in" "$bits_out" 2>/dev/null) + output=$(LANG=C numfmt --to iec --format "%8.2f" -z "$bits_in" "$bits_out" 2>/dev/null) + + if ! echo "$output" | grep -qE '[0-9]{1,3}\.[0-9]{1,3}([K,M,G,B])?$'; then + output=" 0.01 0.01" + fi + echo "$icon $output" else echo "$icon -- --"