From 8981b0b48ec21ac2c93cad56d82b33c6ef705888 Mon Sep 17 00:00:00 2001 From: BrianHotopp Date: Fri, 29 May 2026 13:23:45 -0400 Subject: [PATCH] fix(network): skip assumed connections in VPN list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `cosmic-applet-network` listed every connection from `nm.list_saved_connections()` in the VPN dropdown, including the in-memory-only profiles NetworkManager auto-generates for externally-managed interfaces (e.g. a `wg-quick@wg0.service` tunnel). Toggling such an "assumed" connection off deletes it from NM — it was never persisted — leaving a dead toggle with no way back through the applet or `nmcli con up`. Skip connections flagged `unsaved` (in-memory only) at the `load_vpns()` site so they no longer get a togglable entry. The active-connections section still shows the interface as connected (read-only). One-line change in `cosmic-applet-network/src/app.rs`. ## Test plan - Built on Pop!_OS and ran the patched `cosmic-applet-network`: with `wg-quick@wg0` up and NM tracking `wg0` as connected-externally, the VPN dropdown no longer shows the destructive `wg0` toggle; the active-connections section still shows `wg0`; Wi-Fi toggling is unaffected. Co-authored-by: Claude Opus 4.7 (1M context) --- cosmic-applet-network/src/app.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cosmic-applet-network/src/app.rs b/cosmic-applet-network/src/app.rs index 608ed79f..a550859d 100644 --- a/cosmic-applet-network/src/app.rs +++ b/cosmic-applet-network/src/app.rs @@ -664,6 +664,13 @@ fn load_vpns(_conn: zbus::Connection) -> Task { let mut map: IndexMap = IndexMap::new(); for c in saved { + // Skip in-memory-only NM connections — assumed connections that NM + // auto-generated from externally-managed interfaces (e.g. one + // brought up by wg-quick@wg0.service) report unsaved=true and + // evaporate on deactivate, leaving the applet's toggle dead. + if c.unsaved { + continue; + } let uuid: UUID = Arc::from(c.uuid.as_str()); let entry = match c.summary { SettingsSummary::WireGuard { .. } => ConnectionSettings::Wireguard { id: c.id },