From 49d23f11f49daccf49e9c6cc9e7eabd6f4b4bfe4 Mon Sep 17 00:00:00 2001 From: Yaroslav Date: Sun, 3 May 2020 23:54:41 +0300 Subject: goodbye openvpn, hello wireguard --- dotfiles/.local/bin/barvpnstatus | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'dotfiles/.local/bin/barvpnstatus') diff --git a/dotfiles/.local/bin/barvpnstatus b/dotfiles/.local/bin/barvpnstatus index 7850d94..cca0201 100755 --- a/dotfiles/.local/bin/barvpnstatus +++ b/dotfiles/.local/bin/barvpnstatus @@ -1,9 +1,15 @@ #!/bin/sh -if [ -f "$HOME/.cache/openvpnpid" ]; then - printf " vpn" - exit -fi +isup=$(ip a | grep wg0:) -printf "" +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' -- cgit v1.2.3