From 9c00c48d9e2f0cb0c7cc56a4cac8f629012f40b0 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 14 Sep 2026 13:57:07 +0200 Subject: feat(desktop): pair bluetooth devices Quickshell has no BlueZ agent and no generic D-Bus module, so a pairing that needs a passkey confirmed cannot be done from QML. bluetoothctl registers its own agent, so pairing is the one shell-out; adapter state, scanning, connecting and forgetting all stay native. The timeout is the ceiling: a device bluetoothctl cannot auto-confirm fails visibly rather than hanging the page. --- desktop/modules/bluetooth/BluetoothModule.qml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'desktop/modules/bluetooth/BluetoothModule.qml') diff --git a/desktop/modules/bluetooth/BluetoothModule.qml b/desktop/modules/bluetooth/BluetoothModule.qml index 84ac9a4..80f80b9 100644 --- a/desktop/modules/bluetooth/BluetoothModule.qml +++ b/desktop/modules/bluetooth/BluetoothModule.qml @@ -25,6 +25,7 @@ Module { alwaysActive: true readonly property var adapter: Bluetooth.defaultAdapter + readonly property Pairing pairing: Pairing {} readonly property var devices: Bluetooth.devices ? Bluetooth.devices.values : [] readonly property var connectedDevices: devices.filter(d => d.connected) readonly property var pairedDevices: devices.filter(d => d.paired && !d.connected) @@ -44,6 +45,20 @@ Module { property Process notifyProc: Process {} + // Pairing runs through bluetoothctl; on success connect natively, on + // failure notify, since the drawer may have closed by then. + property Connections pairingConn: Connections { + target: mod.pairing + function onFinished(address, ok) { + if (!ok) { + mod.notify("Bluetooth", "Pairing failed: " + mod.pairing.error); + return; + } + const d = mod.devices.find(x => x.address === address); + if (d) d.connect(); + } + } + tileContent: Component { BluetoothTile { bt: mod } } page: Component { -- cgit v1.2.3