mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-25 13:30:07 +00:00
Added a segment that displays the current IP address.
This commit is contained in:
parent
2bc5a60c7a
commit
b73366f039
1 changed files with 14 additions and 0 deletions
|
@ -115,6 +115,7 @@ case $POWERLEVEL9K_MODE in
|
||||||
LINUX_ICON $'\UE271' #
|
LINUX_ICON $'\UE271' #
|
||||||
SUNOS_ICON $'\U1F31E ' # 🌞
|
SUNOS_ICON $'\U1F31E ' # 🌞
|
||||||
HOME_ICON $'\UE12C' #
|
HOME_ICON $'\UE12C' #
|
||||||
|
NETWORK_ICON $'\UE1AD' #
|
||||||
LOAD_ICON $'\UE190 ' #
|
LOAD_ICON $'\UE190 ' #
|
||||||
#RAM_ICON $'\UE87D' #
|
#RAM_ICON $'\UE87D' #
|
||||||
RAM_ICON $'\UE1E2 ' #
|
RAM_ICON $'\UE1E2 ' #
|
||||||
|
@ -159,6 +160,7 @@ case $POWERLEVEL9K_MODE in
|
||||||
LINUX_ICON 'Lx'
|
LINUX_ICON 'Lx'
|
||||||
SUNOS_ICON 'Sun'
|
SUNOS_ICON 'Sun'
|
||||||
HOME_ICON ''
|
HOME_ICON ''
|
||||||
|
NETWORK_ICON ''
|
||||||
LOAD_ICON ''
|
LOAD_ICON ''
|
||||||
RAM_ICON ''
|
RAM_ICON ''
|
||||||
VCS_UNTRACKED_ICON '?'
|
VCS_UNTRACKED_ICON '?'
|
||||||
|
@ -555,6 +557,18 @@ prompt_icons_test() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prompt_ip() {
|
||||||
|
# TODO: Specify Interface by variable!
|
||||||
|
if [[ "$OS" == "OSX" ]]; then
|
||||||
|
# Try to get IP addresses from common interfaces.
|
||||||
|
ip=$(ipconfig getifaddr en0 || ipconfig getifaddr en1)
|
||||||
|
else
|
||||||
|
# Take the first IP that `hostname -I` gives us.
|
||||||
|
ip=$(hostname -I | grep -o "[0-9.]*" | head -n 1)
|
||||||
|
fi
|
||||||
|
$1_prompt_segment "$0" "cyan" "$DEFAULT_COLOR" "$(print_icon 'NETWORK_ICON') $ip"
|
||||||
|
}
|
||||||
|
|
||||||
prompt_load() {
|
prompt_load() {
|
||||||
if [[ "$OS" == "OSX" ]]; then
|
if [[ "$OS" == "OSX" ]]; then
|
||||||
load_avg_5min=$(sysctl vm.loadavg | grep -o -E -e '[0-9]+\.[0-9]+' | head -n 1)
|
load_avg_5min=$(sysctl vm.loadavg | grep -o -E -e '[0-9]+\.[0-9]+' | head -n 1)
|
||||||
|
|
Loading…
Reference in a new issue