aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/p10k-classic.zsh16
-rw-r--r--config/p10k-lean-8colors.zsh16
-rw-r--r--config/p10k-lean.zsh16
-rw-r--r--config/p10k-rainbow.zsh16
-rw-r--r--internal/p10k.zsh14
5 files changed, 50 insertions, 28 deletions
diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh
index 123ae9c1..b6f81eb6 100644
--- a/config/p10k-classic.zsh
+++ b/config/p10k-classic.zsh
@@ -1452,13 +1452,15 @@
# The following parameters are accessible within the expansion:
#
# Parameter | Meaning
- # ----------------------+---------------
- # P9K_IP_IP | IP address
- # P9K_IP_INTERFACE | network interface
- # P9K_IP_RX_BYTES | total number of bytes received
- # P9K_IP_TX_BYTES | total number of bytes sent
- # P9K_IP_RX_RATE | receive rate (since last prompt)
- # P9K_IP_TX_RATE | send rate (since last prompt)
+ # ----------------------+-------------------------------------------
+ # P9K_IP_IP | IP address
+ # P9K_IP_INTERFACE | network interface
+ # P9K_IP_RX_BYTES | total number of bytes received
+ # P9K_IP_TX_BYTES | total number of bytes sent
+ # P9K_IP_RX_BYTES_DELTA | number of bytes received since last prompt
+ # P9K_IP_TX_BYTES_DELTA | number of bytes sent since last prompt
+ # P9K_IP_RX_RATE | receive rate (since last prompt)
+ # P9K_IP_TX_RATE | send rate (since last prompt)
typeset -g POWERLEVEL9K_IP_CONTENT_EXPANSION='${P9K_IP_RX_RATE:+%70F⇣$P9K_IP_RX_RATE }${P9K_IP_TX_RATE:+%215F⇡$P9K_IP_TX_RATE }%38F$P9K_IP_IP'
# Show information for the first network interface whose name matches this regular expression.
# Run `ifconfig` or `ip -4 a show` to see the names of all network interfaces.
diff --git a/config/p10k-lean-8colors.zsh b/config/p10k-lean-8colors.zsh
index 4f9d8938..abc646b4 100644
--- a/config/p10k-lean-8colors.zsh
+++ b/config/p10k-lean-8colors.zsh
@@ -1433,13 +1433,15 @@
# The following parameters are accessible within the expansion:
#
# Parameter | Meaning
- # ----------------------+---------------
- # P9K_IP_IP | IP address
- # P9K_IP_INTERFACE | network interface
- # P9K_IP_RX_BYTES | total number of bytes received
- # P9K_IP_TX_BYTES | total number of bytes sent
- # P9K_IP_RX_RATE | receive rate (since last prompt)
- # P9K_IP_TX_RATE | send rate (since last prompt)
+ # ----------------------+-------------------------------------------
+ # P9K_IP_IP | IP address
+ # P9K_IP_INTERFACE | network interface
+ # P9K_IP_RX_BYTES | total number of bytes received
+ # P9K_IP_TX_BYTES | total number of bytes sent
+ # P9K_IP_RX_BYTES_DELTA | number of bytes received since last prompt
+ # P9K_IP_TX_BYTES_DELTA | number of bytes sent since last prompt
+ # P9K_IP_RX_RATE | receive rate (since last prompt)
+ # P9K_IP_TX_RATE | send rate (since last prompt)
typeset -g POWERLEVEL9K_IP_CONTENT_EXPANSION='$P9K_IP_IP${P9K_IP_RX_RATE:+ %2F⇣$P9K_IP_RX_RATE}${P9K_IP_TX_RATE:+ %3F⇡$P9K_IP_TX_RATE}'
# Show information for the first network interface whose name matches this regular expression.
# Run `ifconfig` or `ip -4 a show` to see the names of all network interfaces.
diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh
index c3ecb09d..6eb56418 100644
--- a/config/p10k-lean.zsh
+++ b/config/p10k-lean.zsh
@@ -1429,13 +1429,15 @@
# The following parameters are accessible within the expansion:
#
# Parameter | Meaning
- # ----------------------+---------------
- # P9K_IP_IP | IP address
- # P9K_IP_INTERFACE | network interface
- # P9K_IP_RX_BYTES | total number of bytes received
- # P9K_IP_TX_BYTES | total number of bytes sent
- # P9K_IP_RX_RATE | receive rate (since last prompt)
- # P9K_IP_TX_RATE | send rate (since last prompt)
+ # ----------------------+-------------------------------------------
+ # P9K_IP_IP | IP address
+ # P9K_IP_INTERFACE | network interface
+ # P9K_IP_RX_BYTES | total number of bytes received
+ # P9K_IP_TX_BYTES | total number of bytes sent
+ # P9K_IP_RX_BYTES_DELTA | number of bytes received since last prompt
+ # P9K_IP_TX_BYTES_DELTA | number of bytes sent since last prompt
+ # P9K_IP_RX_RATE | receive rate (since last prompt)
+ # P9K_IP_TX_RATE | send rate (since last prompt)
typeset -g POWERLEVEL9K_IP_CONTENT_EXPANSION='$P9K_IP_IP${P9K_IP_RX_RATE:+ %70F⇣$P9K_IP_RX_RATE}${P9K_IP_TX_RATE:+ %215F⇡$P9K_IP_TX_RATE}'
# Show information for the first network interface whose name matches this regular expression.
# Run `ifconfig` or `ip -4 a show` to see the names of all network interfaces.
diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh
index a47fb18e..be6748a2 100644
--- a/config/p10k-rainbow.zsh
+++ b/config/p10k-rainbow.zsh
@@ -1528,13 +1528,15 @@
# The following parameters are accessible within the expansion:
#
# Parameter | Meaning
- # ----------------------+---------------
- # P9K_IP_IP | IP address
- # P9K_IP_INTERFACE | network interface
- # P9K_IP_RX_BYTES | total number of bytes received
- # P9K_IP_TX_BYTES | total number of bytes sent
- # P9K_IP_RX_RATE | receive rate (since last prompt)
- # P9K_IP_TX_RATE | send rate (since last prompt)
+ # ----------------------+-------------------------------------------
+ # P9K_IP_IP | IP address
+ # P9K_IP_INTERFACE | network interface
+ # P9K_IP_RX_BYTES | total number of bytes received
+ # P9K_IP_TX_BYTES | total number of bytes sent
+ # P9K_IP_RX_BYTES_DELTA | number of bytes received since last prompt
+ # P9K_IP_TX_BYTES_DELTA | number of bytes sent since last prompt
+ # P9K_IP_RX_RATE | receive rate (since last prompt)
+ # P9K_IP_TX_RATE | send rate (since last prompt)
typeset -g POWERLEVEL9K_IP_CONTENT_EXPANSION='${P9K_IP_RX_RATE:+⇣$P9K_IP_RX_RATE }${P9K_IP_TX_RATE:+⇡$P9K_IP_TX_RATE }$P9K_IP_IP'
# Show information for the first network interface whose name matches this regular expression.
# Run `ifconfig` or `ip -4 a show` to see the names of all network interfaces.
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 7da836ac..d840e0d8 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -5468,6 +5468,8 @@ function _p9k_prompt_net_iface_init() {
typeset -g P9K_IP_INTERFACE=
typeset -g P9K_IP_TX_BYTES=
typeset -g P9K_IP_RX_BYTES=
+ typeset -g P9K_IP_TX_BYTES_DELTA=
+ typeset -g P9K_IP_RX_BYTES_DELTA=
typeset -g P9K_IP_TX_RATE=
typeset -g P9K_IP_RX_RATE=
typeset -g _p9__ip_timestamp=
@@ -5598,6 +5600,16 @@ function _p9k_prompt_net_iface_async() {
_p9k__public_ip_not_vpn=$public_ip_not_vpn
P9K_IP_IP=$ip_ip
P9K_IP_INTERFACE=$ip_interface
+ if [[ -n $ip_tx_bytes && -n $P9K_IP_TX_BYTES ]]; then
+ P9K_IP_TX_BYTES_DELTA=$((ip_tx_bytes - P9K_IP_TX_BYTES))
+ else
+ P9K_IP_TX_BYTES_DELTA=
+ fi
+ if [[ -n $ip_rx_bytes && -n $P9K_IP_RX_BYTES ]]; then
+ P9K_IP_RX_BYTES_DELTA=$((ip_rx_bytes - P9K_IP_RX_BYTES))
+ else
+ P9K_IP_RX_BYTES_DELTA=
+ fi
P9K_IP_TX_BYTES=$ip_tx_bytes
P9K_IP_RX_BYTES=$ip_rx_bytes
P9K_IP_TX_RATE=$ip_tx_rate
@@ -5611,6 +5623,8 @@ function _p9k_prompt_net_iface_async() {
P9K_IP_INTERFACE \
P9K_IP_TX_BYTES \
P9K_IP_RX_BYTES \
+ P9K_IP_TX_BYTES_DELTA \
+ P9K_IP_RX_BYTES_DELTA \
P9K_IP_TX_RATE \
P9K_IP_RX_RATE \
_p9__ip_timestamp \