diff options
| author | srdusr <trevorgray@srdusr.com> | 2024-02-08 23:55:38 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2024-02-08 23:55:38 +0200 |
| commit | 4d383e4715e7789430d09756faaee3357facac6e (patch) | |
| tree | 12c7a78bb923f9ba2f26a3a8e7ef47a2fecf1524 /.config | |
| parent | 0b01b51a8565ca9af8b911c7be1af0a1bd857ea7 (diff) | |
| download | dotfiles-4d383e4715e7789430d09756faaee3357facac6e.tar.gz dotfiles-4d383e4715e7789430d09756faaee3357facac6e.zip | |
Show default icon and status
Diffstat (limited to '.config')
| -rwxr-xr-x | .config/polybar/scripts/vpn.sh | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/.config/polybar/scripts/vpn.sh b/.config/polybar/scripts/vpn.sh index 27def8a..ab1eb9d 100755 --- a/.config/polybar/scripts/vpn.sh +++ b/.config/polybar/scripts/vpn.sh @@ -1,13 +1,21 @@ #!/bin/sh -country=$(protonvpn s | grep Country) -connection=$(pgrep -a openvpn$ | head -n 1 | awk '{print $NF }' | cut -d '.' -f 1) +# Set a default message +default_message=" vpn" -if [ "$connection" != "" ]; then +# Check if Protonvpn service is running +if pgrep -x "openvpn" >/dev/null; then + # If Protonvpn service is running, get the country + country=$(protonvpn s | grep Country) + # Extract the connection ID + connection=$(pgrep -a openvpn$ | head -n 1 | awk '{print $NF }' | cut -d '.' -f 1) + # Output vpn status with the country if connected echo " vpn" #"$country" else - echo " vpn" + # If Protonvpn service is not running, output default message + echo "$default_message" fi + # #proton_status=$(protonvpn s) #current_status=$(protonvpn s | wc -l) |
