summaryrefslogtreecommitdiff
path: root/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/waybar-vpn35
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