blob: a2cd3c59575dee31cc648e7fbc82bf705be6745f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#!/usr/bin/env bash
RS='\ue0b4'
LS='\ue0b4'
WAN_SYMBOL='\uf0ee'
LAN_SYMBOL='\uf0ed'
if [[ "$1" == "left" ]]; then
echo -ne "#[fg=colour235, bg=colour142] $(tmux display-message -p '#S') #[fg=colour142, bg=colour241]$LS#[default]"
if [[ -f "$HOME/journal.txt" ]]; then
LAST_ENTRY=$(tail -n 1 ~/journal.txt | awk '{ $1=""; print }' | cut -c2-40)
LAST_ENTRY+="..."
else
LAST_ENTRY=$(hostname)
fi
echo -ne "#[fg=colour223, bg=colour241] $LAST_ENTRY #[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 -ne "#[fg=colour235, bg=colour241]$RS#[fg=colour223, bg=colour241] $LAN_SYMBOL $IP_ADDRESS"
WAN_IP=$(curl --max-time 2 -s http://whatismyip.akamai.com/)
echo -ne " $WAN_SYMBOL $WAN_IP #[default]"
DATE=$(date +"%b %d, %H:%M")
echo -ne "#[fg=colour241, bg=colour142]$RS#[fg=colour235] $DATE #[default]"
fi
|