Skip to content

Commit

Permalink
add IP address to status bar
Browse files Browse the repository at this point in the history
  • Loading branch information
katsuma committed Jul 22, 2012
1 parent 6327a9b commit 0fa9c14
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .tmux.conf
Expand Up @@ -30,4 +30,5 @@ set -g message-attr bold
set -g status-left '#[fg=colour235,bg=colour252,bold] ❐ #S #[fg=colour252,bg=colour238,nobold]⮀#[fg=colour245,bg=colour238,bold] #(whoami) #[fg=colour235,bg=colour234,nobold]⮀'
set -g window-status-format "#[fg=white,bg=colour234,nobold] #I #W"
set -g window-status-current-format "#[fg=colour232,bg=colour39,nobold]⮀#[fg=colour25,bg=colour39,noreverse,bold] #I ⮁ #W #[fg=colour32,bg=colour234]⮀"
set -g status-right "#(wemux status_users)"
#set -g status-right "#(wemux status_users)"
set -g status-right "#(~/.tmux/status-right.sh)"
21 changes: 21 additions & 0 deletions .tmux/status-right.sh
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
# Prints the local network IP address.

nic0="en0"
nic1="en1"
ip0=$(/sbin/ifconfig ${nic0} | grep 'inet ')
ip1=$(/sbin/ifconfig ${nic1} | grep 'inet ')

if [ -n "$ip0" ]; then
lan_ip="$ip0"
elif [ -n "$ip1" ]; then
lan_ip="$ip1"
fi

if [ -n "$lan_ip" ]; then
lan_ip=$(echo "$lan_ip" | awk '{ print $2}')
echo "${lan_ip}"
exit 0
else
exit 1
fi

0 comments on commit 0fa9c14

Please sign in to comment.