diff --git a/.config/scripts/vpn.sh b/.config/scripts/vpn.sh new file mode 100644 index 0000000..98d2f2d --- /dev/null +++ b/.config/scripts/vpn.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +VPN_NAME="wg0" + +if nmcli -t -f NAME connection show --active | grep -Fxq "$VPN_NAME"; then + if nmcli connection down "$VPN_NAME"; then + notify-send "VPN" "$VPN_NAME disconnected" + else + notify-send -u critical "VPN Error" "Failed to disconnect $VPN_NAME" + exit 1 + fi +else + if nmcli connection up "$VPN_NAME"; then + notify-send "VPN" "$VPN_NAME connected" + else + notify-send -u critical "VPN Error" "Failed to connect $VPN_NAME" + exit 1 + fi +fi