aboutsummaryrefslogtreecommitdiff
path: root/scripts/powerline.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/powerline.sh')
-rwxr-xr-xscripts/powerline.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/powerline.sh b/scripts/powerline.sh
new file mode 100755
index 0000000..8baf3f2
--- /dev/null
+++ b/scripts/powerline.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+RS=""
+LS=""
+
+if [[ "$1" == "left" ]]; then
+ echo -n "#[fg=colour235, bg=colour142] $(tmux display-message -p '#S') #[fg=colour142, bg=colour241]$LS#[default]"
+ echo -n "#[fg=colour223, bg=colour241] $(hostname) #[fg=colour241, bg=colour235]$LS#[default]"
+fi
+
+if [[ "$1" == "right" ]]; then
+ IP_ADDRESS=$(ip addr show | grep "inet[^6]" | grep -v "\(127.0.0.1\|docker\)" | tr -s ' ' | cut -d ' ' -f3 | cut -d '/' -f1)
+ echo -n "#[fg=colour235, bg=colour241]$RS#[fg=colour223, bg=colour241] ⓛ $IP_ADDRESS"
+ WAN_IP=$(curl --max-time 2 -s http://whatismyip.akamai.com/)
+ echo -n " ⓦ $WAN_IP #[default]"
+ DATE=$(date +"%b %d, %H:%M")
+ echo -n "#[fg=colour241, bg=colour142]$RS#[fg=colour235] $DATE #[default]"
+fi