Show ⌂ before the local IP whether or not a VPN is up. The VPN branch already prefixes ⌂; the non-VPN branch was emitting the bare IP.
18 lines
421 B
Bash
Executable File
18 lines
421 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Emit the tmux status-bar network segment.
|
|
# No VPN: "⌂ <local_ip>"
|
|
# VPN up: "⌂ <local_ip> / ⇡ <vpn_ip>"
|
|
#
|
|
|
|
set -u
|
|
|
|
local_ip=$("$HOME/.local/bin/tmux-ip" 2>/dev/null || true)
|
|
vpn_ip=$("$HOME/.local/bin/tmux-vpn-ip" 2>/dev/null || true)
|
|
|
|
if [ -n "${vpn_ip:-}" ]; then
|
|
printf '\xe2\x8c\x82 %s / \xe2\x87\xa1 %s\n' "${local_ip:-}" "$vpn_ip"
|
|
else
|
|
printf '\xe2\x8c\x82 %s\n' "${local_ip:-}"
|
|
fi
|