aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dot_config/waybar/executable_vpn-status.sh
blob: 9a5016f7d538479d11e0ee49845bda8cbc8cb3b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env dash
# Waybar custom/vpn module: report whether the wireguard interface
# (managed by systemd-networkd) is admin-up. Pango markup makes the
# state visually unambiguous (green shield up, red strikethrough down)
# even before CSS classes are taken into account.

iface=hodor

if ip link show "$iface" 2>/dev/null | grep -qE '<[^>]*\<UP\>'; then
  printf '{"text":"<span color=\\"#b8bb26\\">󰒃 VPN</span>","class":"up","tooltip":"%s up — click to disconnect"}\n' "$iface"
else
  printf '{"text":"<span color=\\"#928374\\"><s>󰒃 VPN</s></span>","class":"down","tooltip":"%s down — click to connect"}\n' "$iface"
fi