diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-14 14:04:44 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-14 14:04:44 +0200 |
| commit | 4eaf3bdce7b4e7663c6ba5c206d68eacbd24949e (patch) | |
| tree | 1183bab6d548425910d5dfc71c948fb64939ec8f /desktop/modules | |
| parent | 5fb6c9636051423254c3f36f0ff19857898c93ad (diff) | |
| download | quickshell-4eaf3bdce7b4e7663c6ba5c206d68eacbd24949e.tar.gz quickshell-4eaf3bdce7b4e7663c6ba5c206d68eacbd24949e.zip | |
fix(desktop): wire tile active state and clear connect errors
Diffstat (limited to 'desktop/modules')
| -rw-r--r-- | desktop/modules/bluetooth/BluetoothModule.qml | 3 | ||||
| -rw-r--r-- | desktop/modules/bluetooth/BluetoothTile.qml | 3 | ||||
| -rw-r--r-- | desktop/modules/network/NetworkModule.qml | 13 | ||||
| -rw-r--r-- | desktop/modules/network/NetworkPage.qml | 4 |
4 files changed, 17 insertions, 6 deletions
diff --git a/desktop/modules/bluetooth/BluetoothModule.qml b/desktop/modules/bluetooth/BluetoothModule.qml index 80f80b9..4fd600f 100644 --- a/desktop/modules/bluetooth/BluetoothModule.qml +++ b/desktop/modules/bluetooth/BluetoothModule.qml @@ -36,6 +36,9 @@ Module { // Null for the first ~2s, then filled. Safe navigation everywhere. icon: mod.adapter && mod.adapter.enabled ? "\uf293" : "\uf05e" + // Active while anything is connected. + active: mod.anyConnected + function notify(title, body) { notifyProc.command = ["notify-send", "--app-name=bluetooth", "--urgency=critical", "--icon=error", title, body]; diff --git a/desktop/modules/bluetooth/BluetoothTile.qml b/desktop/modules/bluetooth/BluetoothTile.qml index 1489f16..226e1da 100644 --- a/desktop/modules/bluetooth/BluetoothTile.qml +++ b/desktop/modules/bluetooth/BluetoothTile.qml @@ -21,6 +21,7 @@ Text { color: bt.anyConnected ? Theme.text : Theme.subtext text: !bt.adapter || !bt.adapter.enabled ? "Off" : bt.connectedDevices.length === 0 ? "No devices" - : bt.connectedDevices.length === 1 ? bt.connectedDevices[0].name + : bt.connectedDevices.length === 1 + ? (bt.connectedDevices[0].name || bt.connectedDevices[0].deviceName || bt.connectedDevices[0].address) : bt.connectedDevices.length + " connected" } diff --git a/desktop/modules/network/NetworkModule.qml b/desktop/modules/network/NetworkModule.qml index d14853f..6ff98b5 100644 --- a/desktop/modules/network/NetworkModule.qml +++ b/desktop/modules/network/NetworkModule.qml @@ -60,6 +60,9 @@ Module { // drawer reads this property like any other. icon: mod.wiredUp ? "\uf796" : (mod.wifiUp ? "\uf1eb" : "\uf05e") + // Active while any link is up. + active: mod.wiredUp || mod.wifiUp + // The network a connect is pending on, so connectionFailed can be caught. property var pendingNetwork: null property string error: "" @@ -76,8 +79,8 @@ Module { net.connectWithPsk(psk); } - function disconnectNetwork(net) { if (net) net.disconnect(); } - function forget(net) { if (net) net.forget(); } + function disconnectNetwork(net) { mod.error = ""; if (net) net.disconnect(); } + function forget(net) { mod.error = ""; if (net) net.forget(); } // A failure after the drawer closed would otherwise go unseen, so it also // raises a notification. Same cached-Process shape as VmModule. @@ -93,10 +96,14 @@ Module { property Connections conn: Connections { target: mod.pendingNetwork function onConnectionFailed(reason) { - mod.error = "Connection failed: " + reason; + mod.error = "Could not connect to " + (mod.pendingNetwork?.name ?? "network"); mod.notify("Network", mod.error); mod.pendingNetwork = null; } + function onConnectedChanged() { + if (mod.pendingNetwork && mod.pendingNetwork.connected) + mod.pendingNetwork = null; + } } tileContent: Component { NetworkTile { net: mod } } diff --git a/desktop/modules/network/NetworkPage.qml b/desktop/modules/network/NetworkPage.qml index 3a6362a..0951231 100644 --- a/desktop/modules/network/NetworkPage.qml +++ b/desktop/modules/network/NetworkPage.qml @@ -66,7 +66,7 @@ Column { } } - Rectangle { width: page.width; height: 1; color: Qt.alpha(Theme.text, 0.12) } + Rectangle { width: page.width; height: 1; visible: page.net.wiredDevices.length > 0; color: Qt.alpha(Theme.text, 0.12) } // --- Wifi --- @@ -106,7 +106,7 @@ Column { Button { text: page.net.wifiDevice && page.net.wifiDevice.scannerEnabled ? "Scanning…" : "Scan" - onClicked: if (page.net.wifiDevice) page.net.wifiDevice.scannerEnabled = true + onClicked: if (page.net.wifiDevice) page.net.wifiDevice.scannerEnabled = !page.net.wifiDevice.scannerEnabled } } |
