Files
dotfiles/i3/.config/i3blocks/workvpn

21 lines
324 B
Bash
Executable File

#!/usr/bin/env bash
status=$(ip a show ppp1 2>/dev/null || "")
[ -z "$status" ] && exit 0
icon=󱁤
color="#808080"
text=""
ip=$(grep -Po 'inet \K(\d+\.){3}\d+' <<<$status)
if [ -z "$ip" ]; then
text="$icon wait..."
color="#ffff00"
else
text="$icon $ip"
color="#80ff80"
fi
echo "$text"
echo "$text"
echo "$color"