summaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorlemaral <lemaral@users.noreply.github.com>2017-11-15 00:23:19 +0300
committerGitHub <noreply@github.com>2017-11-15 00:23:19 +0300
commit7f9669d28a52b566560c97f948d9ddf6366c0580 (patch)
treef314a49871b15a2e60ecd0fbe55e92d91653d3d2 /powerlevel9k.zsh-theme
parent87acc51acab3ed4fd33cda2386abed6f98c80720 (diff)
Replace PUBLIC_IP_ICON with VPN_ICON if VPN is up
Replace PUBLIC_IP_ICON with VPN_ICON if $POWERLEVEL9K_PUBLIC_IP_VPN_INTERFACE is set and up
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme12
1 files changed, 10 insertions, 2 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 73178865..54528fc7 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -555,8 +555,16 @@ prompt_public_ip() {
# Draw the prompt segment
if [[ -n $public_ip ]]; then
- $1_prompt_segment "$0" "$2" "$DEFAULT_COLOR" "$DEFAULT_COLOR_INVERTED" "${public_ip}" 'PUBLIC_IP_ICON'
- fi
+ icon='PUBLIC_IP_ICON'
+ # Check VPN is on if VPN interface is set
+ if [[ -n $POWERLEVEL9K_PUBLIC_IP_VPN_INTERFACE ]]; then
+ for vpn_iface in $(/sbin/ifconfig | grep -e ^"$POWERLEVEL9K_PUBLIC_IP_VPN_INTERFACE" | cut -d":" -f1)
+ do
+ icon='VPN_ICON'
+ break
+ done
+ fi
+ $1_prompt_segment "$0" "$2" "$DEFAULT_COLOR" "$DEFAULT_COLOR_INVERTED" "${public_ip}" "$icon" fi
}
# Context: user@hostname (who am I and where am I)