aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2020-02-05 19:26:16 +0300
committerromkatv <roman.perepelitsa@gmail.com>2020-02-05 19:26:16 +0300
commit75e5712cd036feb13307abdcbca71f634bed1ecd (patch)
tree80f29f3b60baa08b5476a4740eb999544f2ae2fe
parent01cce2c4eb91bbcfa08394b452f88b872df356f5 (diff)
slightly shorter bandwidth display
-rw-r--r--internal/p10k.zsh10
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 7fe3f237..d44417b2 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -4597,7 +4597,7 @@ function _p9k_prompt_net_iface_async() {
fi
if _p9k_prompt_net_iface_match $_POWERLEVEL9K_IP_INTERFACE; then
local ip_ip=$ip ip_interface=$iface ip_timestamp=$EPOCHREALTIME
- local ip_tx_bytes=0 ip_rx_bytes=0 ip_tx_rate='0 Bps' ip_rx_rate='0 Bps'
+ local ip_tx_bytes=0 ip_rx_bytes=0 ip_tx_rate='0 B/s' ip_rx_rate='0 B/s'
if [[ $_p9k_os == (Linux|Android) ]]; then
if [[ -r /sys/class/net/$iface/statistics/rx_bytes ]] &&
_p9k_read_file /sys/class/net/$iface/statistics/rx_bytes; then
@@ -4625,10 +4625,10 @@ function _p9k_prompt_net_iface_async() {
ip_tx_rate=$P9K_IP_TX_RATE
ip_rx_rate=$P9K_IP_RX_RATE
else
- _p9k_human_readable_bytes $((8 * (ip_tx_bytes - P9K_IP_TX_BYTES) / t))
- ip_tx_rate="$_p9k_ret[1,-2] $_p9k_ret[-1]bps"
- _p9k_human_readable_bytes $((8 * (ip_rx_bytes - P9K_IP_RX_BYTES) / t))
- ip_rx_rate="$_p9k_ret[1,-2] $_p9k_ret[-1]bps"
+ _p9k_human_readable_bytes $(((ip_tx_bytes - P9K_IP_TX_BYTES) / t))
+ [[ $_p9k_ret == *B ]] && ip_tx_rate="$_p9k_ret[1,-2] B/s" || ip_tx_rate="$_p9k_ret[1,-2] $_p9k_ret[-1]iB/s"
+ _p9k_human_readable_bytes $(((ip_rx_bytes - P9K_IP_RX_BYTES) / t))
+ [[ $_p9k_ret == *B ]] && ip_rx_rate="$_p9k_ret[1,-2] B/s" || ip_rx_rate="$_p9k_ret[1,-2] $_p9k_ret[-1]iB/s"
fi
fi
else