diff --git a/Modules/TopBar/VpnPopout.qml b/Modules/TopBar/VpnPopout.qml index 2d5a178c..446fbce5 100644 --- a/Modules/TopBar/VpnPopout.qml +++ b/Modules/TopBar/VpnPopout.qml @@ -240,7 +240,7 @@ DankPopout { spacing: Theme.spacingS DankIcon { - name: modelData.uuid === VpnService.activeUuid ? "vpn_lock" : "vpn_key_off" + name: VpnService.isActiveUuid(modelData.uuid) ? "vpn_lock" : "vpn_key_off" size: Theme.iconSize - 4 color: VpnService.isActiveUuid(modelData.uuid) ? Theme.primary : Theme.surfaceText Layout.alignment: Qt.AlignVCenter @@ -250,17 +250,35 @@ DankPopout { spacing: 2 Layout.alignment: Qt.AlignVCenter - StyledText { - text: modelData.name - font.pixelSize: Theme.fontSizeMedium - color: VpnService.isActiveUuid(modelData.uuid) ? Theme.primary : Theme.surfaceText - } + StyledText { + text: modelData.name + font.pixelSize: Theme.fontSizeMedium + color: VpnService.isActiveUuid(modelData.uuid) ? Theme.primary : Theme.surfaceText + } - StyledText { - text: (modelData.type === "wireguard" ? "WireGuard" : (modelData.type ? modelData.type.toUpperCase() : "VPN")) - font.pixelSize: Theme.fontSizeSmall - color: Theme.surfaceTextMedium + StyledText { + text: { + if (modelData.type === "wireguard") return "WireGuard" + var svc = modelData.serviceType || "" + if (svc.indexOf("openvpn") !== -1) return "OpenVPN" + if (svc.indexOf("wireguard") !== -1) return "WireGuard (plugin)" + if (svc.indexOf("openconnect") !== -1) return "OpenConnect" + if (svc.indexOf("fortissl") !== -1 || svc.indexOf("forti") !== -1) return "Fortinet" + if (svc.indexOf("strongswan") !== -1) return "IPsec (strongSwan)" + if (svc.indexOf("libreswan") !== -1) return "IPsec (Libreswan)" + if (svc.indexOf("l2tp") !== -1) return "L2TP/IPsec" + if (svc.indexOf("pptp") !== -1) return "PPTP" + if (svc.indexOf("vpnc") !== -1) return "Cisco (vpnc)" + if (svc.indexOf("sstp") !== -1) return "SSTP" + if (svc) { + var parts = svc.split('.') + return parts[parts.length-1] + } + return "VPN" } + font.pixelSize: Theme.fontSizeSmall + color: Theme.surfaceTextMedium + } } Item { Layout.fillWidth: true; height: 1 } } diff --git a/Services/VpnService.qml b/Services/VpnService.qml index f06c6b56..8ac67e8f 100644 --- a/Services/VpnService.qml +++ b/Services/VpnService.qml @@ -72,7 +72,7 @@ Singleton { Process { id: getProfiles - command: ["nmcli", "-t", "-f", "NAME,UUID,TYPE", "connection", "show"] + command: ["bash", "-lc", "nmcli -t -f NAME,UUID,TYPE connection show | while IFS=: read -r name uuid type; do case \"$type\" in vpn) svc=$(nmcli -g vpn.service-type connection show uuid \"$uuid\" 2>/dev/null); echo \"$name:$uuid:$type:$svc\" ;; wireguard) echo \"$name:$uuid:$type:\" ;; *) : ;; esac; done"] running: false stdout: StdioCollector { onStreamFinished: { @@ -81,7 +81,8 @@ Singleton { for (const line of lines) { const parts = line.split(':') if (parts.length >= 3 && (parts[2] === "vpn" || parts[2] === "wireguard")) { - out.push({ name: parts[0], uuid: parts[1], type: parts[2] }) + const svc = parts.length >= 4 ? parts[3] : "" + out.push({ name: parts[0], uuid: parts[1], type: parts[2], serviceType: svc }) } } root.profiles = out