This commit is contained in:
Damocles 2026-04-12 18:44:27 +02:00
parent 21f96dc68e
commit b06e3582ff
23 changed files with 597 additions and 197 deletions

View file

@ -13,12 +13,7 @@ M.PopupPanel {
property Process _scanner: Process {
id: scanner
running: true
command: ["sh", "-c",
"echo '---CONNS---';" +
"nmcli -t -f NAME,UUID,TYPE,ACTIVE connection show 2>/dev/null;" +
"echo '---WIFI---';" +
"nmcli -t -f SSID,SIGNAL device wifi list --rescan no 2>/dev/null"
]
command: ["sh", "-c", "echo '---CONNS---';" + "nmcli -t -f NAME,UUID,TYPE,ACTIVE connection show 2>/dev/null;" + "echo '---WIFI---';" + "nmcli -t -f SSID,SIGNAL device wifi list --rescan no 2>/dev/null"]
stdout: StdioCollector {
onStreamFinished: {
const sections = text.split("---WIFI---");
@ -28,16 +23,19 @@ M.PopupPanel {
// Visible SSIDs with signal
const visible = {};
for (const l of wifiLines.trim().split("\n")) {
if (!l) continue;
if (!l)
continue;
const parts = l.split(":");
const ssid = parts[0];
if (ssid) visible[ssid] = parseInt(parts[1]) || 0;
if (ssid)
visible[ssid] = parseInt(parts[1]) || 0;
}
// Saved connections filter: show wired always, wifi only if visible
const nets = [];
for (const l of connLines.trim().split("\n")) {
if (!l) continue;
if (!l)
continue;
const parts = l.split(":");
const name = parts[0];
const uuid = parts[1];
@ -45,7 +43,8 @@ M.PopupPanel {
const active = parts[3] === "yes";
const isWifi = type.includes("wireless");
if (isWifi && !(name in visible)) continue;
if (isWifi && !(name in visible))
continue;
nets.push({
name: name,
@ -58,8 +57,10 @@ M.PopupPanel {
// Active first, then by signal (wifi) or name
nets.sort((a, b) => {
if (a.active !== b.active) return a.active ? -1 : 1;
if (a.signal >= 0 && b.signal >= 0) return b.signal - a.signal;
if (a.active !== b.active)
return a.active ? -1 : 1;
if (a.signal >= 0 && b.signal >= 0)
return b.signal - a.signal;
return a.name.localeCompare(b.name);
});
@ -72,14 +73,16 @@ M.PopupPanel {
id: connectProc
property string uuid: ""
command: ["nmcli", "connection", "up", uuid]
onRunningChanged: if (!running) scanner.running = true
onRunningChanged: if (!running)
scanner.running = true
}
property Process _disconnectProc: Process {
id: disconnectProc
property string uuid: ""
command: ["nmcli", "connection", "down", uuid]
onRunningChanged: if (!running) scanner.running = true
onRunningChanged: if (!running)
scanner.running = true
}
Repeater {