fix: remove duplicate VPN notifications from moonarch-vpn
All checks were successful
Update PKGBUILD version / update-pkgver (push) Successful in 2s
All checks were successful
Update PKGBUILD version / update-pkgver (push) Successful in 2s
nm-applet already sends notifications for VPN state changes. The script's own notify-send calls caused duplicates on every toggle. Closes #4
This commit is contained in:
parent
fdedc8071f
commit
27247a4ffb
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user