aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin/barvpnstatus
blob: cca020164096655943bd5e5b6253bb59e6d7c950 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh

isup=$(ip a | grep wg0:)

if [ -n "$isup" ]; then
    printf " vpn\n"
else
  printf ""
fi

# For some goddamned weird reason sed crashes with a
# "couldn't flush stdout: broken pipe" error when running from waybar itself
# if I don't call sed from its hard location, so I had to call it using
# /usr/bin/sed
nmcli monitor | grep -E --line-buffered 'wg0: connected|wg0: disconnected' | /usr/bin/sed --unbuffered 's/wg0: connected/ vpn/g;s/wg0: disconnected//g'