diff --git a/bin/vpn_status.sh b/bin/vpn_status.sh index 671aecd..71e3f6f 100755 --- a/bin/vpn_status.sh +++ b/bin/vpn_status.sh @@ -12,14 +12,17 @@ if ! command -v mullvad &>/dev/null ; then exit 1 fi -# getting vpn status -VPN_DISCONNECTED=$(mullvad status | grep Disconnected) +# reading vpn status as continous output +while read VPN_STATUS; do -if [[ -n "$VPN_DISCONNECTED" ]] ; then - # vpn is disconnected - echo "$DISCONNECTED" - exit 0 -fi + VPN_DISCONNECTED=$(echo "$VPN_STATUS" | grep Disconnect); + + if [[ -n "$VPN_DISCONNECTED" ]] ; then + # vpn is disconnected + echo "$DISCONNECTED" + continue + fi -# connected -echo "$CONNECTED" + # connected + echo "$CONNECTED" +done < <(mullvad status listen) diff --git a/gui/polybar/config.ini b/gui/polybar/config.ini index f56977b..b9a5db6 100644 --- a/gui/polybar/config.ini +++ b/gui/polybar/config.ini @@ -307,7 +307,7 @@ exec = printf "%s %s\n" `echo -e '\ueb29'` `pacman -Qu | wc -l` ; custom vpn script type = custom/script exec = vpn_status.sh -interval = 30 +tail = true [settings] screenchange-reload = true