mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-18 05:40:07 +00:00
add vpn ip to prompt
This commit is contained in:
parent
92264124a9
commit
5eec2e28d0
3 changed files with 30 additions and 6 deletions
|
@ -94,6 +94,7 @@ The segments that are currently available are:
|
||||||
* `history` - The command number for the current line.
|
* `history` - The command number for the current line.
|
||||||
* [`host`](#host) - Your current host name
|
* [`host`](#host) - Your current host name
|
||||||
* [`ip`](#ip) - Shows the current IP address.
|
* [`ip`](#ip) - Shows the current IP address.
|
||||||
|
* [`vpn`](#vpn) - Shows the current VPN IP address.
|
||||||
* [`public_ip`](#public_ip) - Shows your public IP address.
|
* [`public_ip`](#public_ip) - Shows your public IP address.
|
||||||
* `load` - Your machine's load averages.
|
* `load` - Your machine's load averages.
|
||||||
* `os_icon` - Display a nice little icon, depending on your operating system.
|
* `os_icon` - Display a nice little icon, depending on your operating system.
|
||||||
|
@ -444,6 +445,14 @@ specify the correct network interface by setting:
|
||||||
|----------|---------------|-------------|
|
|----------|---------------|-------------|
|
||||||
|`POWERLEVEL9K_IP_INTERFACE`|None|The NIC for which you wish to display the IP address. Example: `eth0`.|
|
|`POWERLEVEL9K_IP_INTERFACE`|None|The NIC for which you wish to display the IP address. Example: `eth0`.|
|
||||||
|
|
||||||
|
##### vpn
|
||||||
|
|
||||||
|
This segment tries to extract the VPN related IP addresses from nmcli, based on the NIC type:
|
||||||
|
|
||||||
|
| Variable | Default Value | Description |
|
||||||
|
|----------|---------------|-------------|
|
||||||
|
|`POWERLEVEL9K_VPN_IP_INTERFACE`|tun|The VPN NIC type|
|
||||||
|
|
||||||
##### public_ip
|
##### public_ip
|
||||||
|
|
||||||
This segment will display your public IP address. There are several methods of obtaining this
|
This segment will display your public IP address. There are several methods of obtaining this
|
||||||
|
|
|
@ -84,6 +84,7 @@ case $POWERLEVEL9K_MODE in
|
||||||
LOCK_ICON $'\UE138' #
|
LOCK_ICON $'\UE138' #
|
||||||
EXECUTION_TIME_ICON $'\UE89C' #
|
EXECUTION_TIME_ICON $'\UE89C' #
|
||||||
SSH_ICON '(ssh)'
|
SSH_ICON '(ssh)'
|
||||||
|
VPN_ICON '(vpn)'
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
'awesome-fontconfig')
|
'awesome-fontconfig')
|
||||||
|
@ -145,13 +146,14 @@ case $POWERLEVEL9K_MODE in
|
||||||
VCS_GIT_GITLAB_ICON $'\uF296 ' #
|
VCS_GIT_GITLAB_ICON $'\uF296 ' #
|
||||||
VCS_HG_ICON $'\uF0C3 ' #
|
VCS_HG_ICON $'\uF0C3 ' #
|
||||||
VCS_SVN_ICON '(svn) '
|
VCS_SVN_ICON '(svn) '
|
||||||
RUST_ICON $'\uE6A8' #
|
RUST_ICON $'\uE6A8' #
|
||||||
PYTHON_ICON $'\U1F40D' # 🐍
|
PYTHON_ICON $'\U1F40D' # 🐍
|
||||||
SWIFT_ICON ''
|
SWIFT_ICON ''
|
||||||
PUBLIC_IP_ICON ''
|
PUBLIC_IP_ICON ''
|
||||||
LOCK_ICON $'\UE138' #
|
LOCK_ICON $'\UE138' #
|
||||||
EXECUTION_TIME_ICON $'\uF253'
|
EXECUTION_TIME_ICON $'\uF253'
|
||||||
SSH_ICON '(ssh)'
|
SSH_ICON '(ssh)'
|
||||||
|
VPN_ICON $'\uF023'
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
'nerdfont-complete'|'nerdfont-fontconfig')
|
'nerdfont-complete'|'nerdfont-fontconfig')
|
||||||
|
@ -174,7 +176,7 @@ case $POWERLEVEL9K_MODE in
|
||||||
TEST_ICON $'\uF188' #
|
TEST_ICON $'\uF188' #
|
||||||
TODO_ICON $'\uF133' #
|
TODO_ICON $'\uF133' #
|
||||||
BATTERY_ICON $'\UF240 ' #
|
BATTERY_ICON $'\UF240 ' #
|
||||||
DISK_ICON $'\uF0A0' #
|
DISK_ICON $'\uF0A0' #
|
||||||
OK_ICON $'\uF00C' #
|
OK_ICON $'\uF00C' #
|
||||||
FAIL_ICON $'\uF00D' #
|
FAIL_ICON $'\uF00D' #
|
||||||
SYMFONY_ICON $'\uE757' #
|
SYMFONY_ICON $'\uE757' #
|
||||||
|
@ -210,16 +212,17 @@ case $POWERLEVEL9K_MODE in
|
||||||
VCS_GIT_ICON $'\uF113 ' #
|
VCS_GIT_ICON $'\uF113 ' #
|
||||||
VCS_GIT_GITHUB_ICON $'\uE709 ' #
|
VCS_GIT_GITHUB_ICON $'\uE709 ' #
|
||||||
VCS_GIT_BITBUCKET_ICON $'\uE703 ' #
|
VCS_GIT_BITBUCKET_ICON $'\uE703 ' #
|
||||||
VCS_GIT_GITLAB_ICON $'\uF296 ' #
|
VCS_GIT_GITLAB_ICON $'\uF296 ' #
|
||||||
VCS_HG_ICON $'\uF0C3 ' #
|
VCS_HG_ICON $'\uF0C3 ' #
|
||||||
VCS_SVN_ICON $'\uE72D ' #
|
VCS_SVN_ICON $'\uE72D ' #
|
||||||
RUST_ICON $'\uE7A8 ' #
|
RUST_ICON $'\uE7A8 ' #
|
||||||
PYTHON_ICON $'\UE73C ' #
|
PYTHON_ICON $'\UE73C ' #
|
||||||
SWIFT_ICON $'\uE755' #
|
SWIFT_ICON $'\uE755' #
|
||||||
PUBLIC_IP_ICON $'\UF0AC' #
|
PUBLIC_IP_ICON $'\UF0AC' #
|
||||||
LOCK_ICON $'\UF023' #
|
LOCK_ICON $'\UF023' #
|
||||||
EXECUTION_TIME_ICON $'\uF252' #
|
EXECUTION_TIME_ICON $'\uF252' #
|
||||||
SSH_ICON $'\uF489' #
|
SSH_ICON $'\uF489' #
|
||||||
|
VPN_ICON '(vpn)'
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -288,6 +291,7 @@ case $POWERLEVEL9K_MODE in
|
||||||
LOCK_ICON $'\UE0A2'
|
LOCK_ICON $'\UE0A2'
|
||||||
EXECUTION_TIME_ICON 'Dur'
|
EXECUTION_TIME_ICON 'Dur'
|
||||||
SSH_ICON '(ssh)'
|
SSH_ICON '(ssh)'
|
||||||
|
VPN_ICON '(vpn)'
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -914,6 +914,17 @@ prompt_ip() {
|
||||||
"$1_prompt_segment" "$0" "$2" "cyan" "$DEFAULT_COLOR" "$ip" 'NETWORK_ICON'
|
"$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() {
|
prompt_load() {
|
||||||
# The load segment can have three different states
|
# The load segment can have three different states
|
||||||
local current_state="unknown"
|
local current_state="unknown"
|
||||||
|
|
Loading…
Reference in a new issue