aboutsummaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2019-01-23 21:10:46 +0300
committerDominik Ritter <dritter03@googlemail.com>2019-01-23 21:10:46 +0300
commit747b94b1b6b8450375a2b1619d8a5c7336be1852 (patch)
tree164feac2dadb6e42735873b76b2c2d079caa2814 /powerlevel9k.zsh-theme
parentbde4337992e01738e72ef589c321299193580838 (diff)
Match VPN interface fuzzy on Linux
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme11
1 files changed, 9 insertions, 2 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 081562b5..3db36050 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -620,8 +620,15 @@ prompt_public_ip() {
fi
done
else
- local interface=$(${ROOT_PREFIX}/sbin/ip -brief -4 a show "${POWERLEVEL9K_PUBLIC_IP_VPN_INTERFACE}")
- [[ -n "$interface" ]] && icon='VPN_ICON'
+ local -a interfaces
+ interfaces=( "${(f)$(${ROOT_PREFIX}/sbin/ip -brief -4 a show)}" )
+ local pattern="^${POWERLEVEL9K_PUBLIC_IP_VPN_INTERFACE}[ ]+UP[ ]+"
+ for interface in "${(@)interfaces}"; do
+ if [[ "$interface" =~ $pattern ]]; then
+ icon='VPN_ICON'
+ break
+ fi
+ done
fi
fi
$1_prompt_segment "$0" "$2" "$DEFAULT_COLOR" "$DEFAULT_COLOR_INVERTED" "${public_ip}" "$icon"