From 27247a4ffb05bd1657f7a96672090acc33138737 Mon Sep 17 00:00:00 2001 From: nevaforget Date: Tue, 7 Apr 2026 10:19:41 +0200 Subject: [PATCH] fix: remove duplicate VPN notifications from moonarch-vpn nm-applet already sends notifications for VPN state changes. The script's own notify-send calls caused duplicates on every toggle. Closes #4 --- defaults/bin/moonarch-vpn | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) 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