diff --git a/defaults/bin/moonarch-vpn b/defaults/bin/moonarch-vpn index 5167966..48d2b80 100755 --- a/defaults/bin/moonarch-vpn +++ b/defaults/bin/moonarch-vpn @@ -10,7 +10,7 @@ ACTIVE_PREFIX="󰌘 " INACTIVE_PREFIX="󰌙 " -for cmd in nmcli walker notify-send; do +for cmd in nmcli walker; do command -v "$cmd" >/dev/null 2>&1 || { echo "Error: '$cmd' not found" >&2 exit 1 @@ -35,29 +35,17 @@ function extract_connection_name() { echo "$result" } -# Connect a VPN and notify the result. +# Connect a VPN. # Requires nm-applet (or another NM secret agent) for interactive auth. function connect_vpn() { local connection="$1" - local feedback - - if feedback=$(nmcli connection up "$connection" 2>&1); then - notify-send "VPN" "Connected to '$connection'" - else - notify-send -u critical "VPN" "Connection failed: $feedback" - fi + nmcli connection up "$connection" } -# Disconnect a VPN and notify the result. +# Disconnect a VPN. function disconnect_vpn() { local connection="$1" - local feedback - - if feedback=$(nmcli connection down "$connection" 2>&1); then - notify-send "VPN" "Disconnected from '$connection'" - else - notify-send -u critical "VPN" "Disconnect failed: $feedback" - fi + nmcli connection down "$connection" } # Toggle the VPN connection based on its current state. @@ -89,7 +77,6 @@ function main() { connections=$(list_vpn_connections) if [[ -z "$connections" ]]; then - notify-send "VPN" "No VPN connections configured" exit 0 fi