aboutsummaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorDavid Sabatie <david.sabatie@sigfox.com>2017-05-31 18:32:42 +0300
committerDavid Sabatie <david.sabatie@sigfox.com>2017-05-31 18:32:42 +0300
commit5eec2e28d0e44b2ac168fc3e08a38d68d4cb4fbe (patch)
tree530469cc3cc972776b75cf59b6796c4a5c7817fb /powerlevel9k.zsh-theme
parent92264124a9a3894b86ec66617d5e40dea77cd2f1 (diff)
add vpn ip to prompt
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme11
1 files changed, 11 insertions, 0 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 666ce965..760de5a9 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -914,6 +914,17 @@ prompt_ip() {
"$1_prompt_segment" "$0" "$2" "cyan" "$DEFAULT_COLOR" "$ip" 'NETWORK_ICON'
}
+set_default POWERLEVEL9K_VPN_IP_INTERFACE "tun"
+# prompt if vpn active
+prompt_vpn_ip() {
+ for vpn_iface in $(ip tuntap | grep -e ^"$POWERLEVEL9K_VPN_IP_INTERFACE" | cut -d":" -f1)
+ do
+ ip=$(ip -4 a show "$vpn_iface" | grep -o "inet\s*[0-9.]*" | grep -o "[0-9.]*")
+ "$1_prompt_segment" "$0" "$2" "cyan" "$DEFAULT_COLOR" "$ip" 'VPN_ICON'
+ done
+}
+
+
prompt_load() {
# The load segment can have three different states
local current_state="unknown"