aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dot_config/waybar/executable_vpn-status.sh
blob: 37fea84afaf6a38c11011f0a693e2b55dde94847 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh
# Waybar custom/vpn module: report whether the wireguard interface
# (managed by systemd-networkd) is admin-up. Output is a single line of
# JSON so waybar can style it via the .up / .down classes.

iface=hodor

if ip link show "$iface" 2>/dev/null | grep -qE '<[^>]*\<UP\>'; then
  printf '{"text":"VPN","class":"up","tooltip":"%s up"}\n' "$iface"
else
  printf '{"text":"VPN","class":"down","tooltip":"%s down"}\n' "$iface"
fi