aurorab2c867c
aurora: stop wifi list rescans, keep profiles on connect timeout
+8 −4
1 file changed
| @@ -195,8 +195,9 @@ Singleton { | |||
| 195 | 195 | var out = lines.join(" ").trim() | |
| 196 | 196 | if (rc !== 0) { | |
| 197 | 197 | message = out | |
| 198 | − | // a failed first-time connect leaves a broken profile behind; drop it | |
| 199 | − | if (lastWasNew && lastSsid !== "") | |
| 198 | + | // a failed first-time connect (wrong password: rc 4) leaves a broken profile behind; drop it. | |
| 199 | + | // Not on a timeout (rc 3): NM is still activating (slow campus DHCP) and deleting would abort it. | |
| 200 | + | if (rc === 4 && lastWasNew && lastSsid !== "") | |
| 200 | 201 | Quickshell.execDetached(["nmcli", "connection", "delete", "id", lastSsid]) | |
| 201 | 202 | } else { | |
| 202 | 203 | message = "" | |
| @@ -222,7 +223,7 @@ Singleton { | |||
| 222 | 223 | run(["connection", "up", "id", ssid]) | |
| 223 | 224 | } else { | |
| 224 | 225 | lastWasNew = !isSaved | |
| 225 | − | var cmd = ["--wait", "20", "device", "wifi", "connect", ssid] | |
| 226 | + | var cmd = ["--wait", "60", "device", "wifi", "connect", ssid] | |
| 226 | 227 | if (password) cmd = cmd.concat(["password", password]) | |
| 227 | 228 | run(cmd) | |
| 228 | 229 | } | |
| @@ -322,9 +323,12 @@ Singleton { | |||
| 322 | 323 | } | |
| 323 | 324 | } | |
| 324 | 325 | ||
| 326 | + | // --rescan no: a plain `wifi list` starts a full scan when the last one is >30s old, i.e. on every | |
| 327 | + | // poll. Constant scans make the card roam (5 GHz -> weak 2.4 GHz), which drops the DHCP lease | |
| 328 | + | // behind captive portals. Scans only come from rescan() (Net tab opened / button) and NM itself. | |
| 325 | 329 | Process { | |
| 326 | 330 | id: listProc | |
| 327 | − | command: ["nmcli", "-t", "-f", "IN-USE,SSID,SIGNAL,SECURITY", "device", "wifi", "list"] | |
| 331 | + | command: ["nmcli", "-t", "-f", "IN-USE,SSID,SIGNAL,SECURITY", "device", "wifi", "list", "--rescan", "no"] | |
| 328 | 332 | stdout: StdioCollector { | |
| 329 | 333 | onStreamFinished: { | |
| 330 | 334 | var best = {}, lines = text.split("\n") | |