aboutsummaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2015-08-26 18:36:04 +0300
committerDominik Ritter <dritter03@googlemail.com>2015-08-26 18:36:04 +0300
commitb73366f039c8577cf8848fbbae7fda6221558155 (patch)
tree8720ab72f9b045c309a2e90cee81899967f0b677 /powerlevel9k.zsh-theme
parent2bc5a60c7a84e4b59a8012e3cab82a32b254c406 (diff)
Added a segment that displays the current IP address.
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rw-r--r--powerlevel9k.zsh-theme14
1 files changed, 14 insertions, 0 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 8a5ce2b1..99c95156 100644
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -115,6 +115,7 @@ case $POWERLEVEL9K_MODE in
LINUX_ICON $'\UE271' # 
SUNOS_ICON $'\U1F31E ' # 🌞
HOME_ICON $'\UE12C' # 
+ NETWORK_ICON $'\UE1AD' # 
LOAD_ICON $'\UE190 ' # 
#RAM_ICON $'\UE87D' # 
RAM_ICON $'\UE1E2 ' # 
@@ -159,6 +160,7 @@ case $POWERLEVEL9K_MODE in
LINUX_ICON 'Lx'
SUNOS_ICON 'Sun'
HOME_ICON ''
+ NETWORK_ICON ''
LOAD_ICON ''
RAM_ICON ''
VCS_UNTRACKED_ICON '?'
@@ -555,6 +557,18 @@ prompt_icons_test() {
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() {
if [[ "$OS" == "OSX" ]]; then
load_avg_5min=$(sysctl vm.loadavg | grep -o -E -e '[0-9]+\.[0-9]+' | head -n 1)