diff options
| author | ryukamish <[email protected]> | 2026-06-25 13:09:25 +0530 |
|---|---|---|
| committer | ryukamish <[email protected]> | 2026-06-25 13:09:25 +0530 |
| commit | b7535c43ee05e543842ea55da66c31aa444ea7af (patch) | |
| tree | 1d331f3a63d5312d16656970c7c7c77f1a31fba0 /.local | |
| parent | 88ad6b51e3ed35a6c0f4e243be67b528ba991dc5 (diff) | |
fix: only show the status of vpn connection
Diffstat (limited to '.local')
| -rwxr-xr-x | .local/bin/waybar-vpn | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/.local/bin/waybar-vpn b/.local/bin/waybar-vpn index 008e743..f746aec 100755 --- a/.local/bin/waybar-vpn +++ b/.local/bin/waybar-vpn @@ -1,31 +1,8 @@ #!/bin/sh -# first user argument -cmd="$1" - -case "$cmd" in - connect) - # TODO: handle root permission password input - if [ -n $(type "nmcli") ]; then - nmcli connection show --active \ - rg -i 'wireguard' - fi - ;; - disconnect) - # `wg-quick` requires root permission to disconnect - # don't have the solution right now - ;; - status) - vpn=$(nmcli connection show --active | rg -i 'wireguard' | awk '{print $1}') - if [ -n "$vpn" ]; then - printf "{\"text\": \"$vpn\", \"class\": \"wireguard\", \"alt\": \"disconnected\" }\n" - else - printf "{\"text\": \"DC'D\", \"class\": \"wireguard\", \"alt\": \"disconnected\" }\n" - fi - ;; - *) - # print usage if not used with any of the below three commands - echo -e "Usage: %s {status|connect|disconnect}\n" - exit 1 - ;; -esac +vpn=$(nmcli connection show --active | rg -i 'wireguard' | awk '{print $1}') +if [ -n "$vpn" ]; then + printf "{\"text\": \"$vpn\", \"class\": \"wireguard\", \"alt\": \"disconnected\" }\n" +else + printf "{\"text\": \"DC'D\", \"class\": \"wireguard\", \"alt\": \"disconnected\" }\n" +fi |
