diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-14 13:57:07 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-14 13:57:07 +0200 |
| commit | 9c00c48d9e2f0cb0c7cc56a4cac8f629012f40b0 (patch) | |
| tree | fa42e2cfd058426a8dd5da7eed3123925751a8f4 /desktop/modules/bluetooth/BluetoothModule.qml | |
| parent | 97dd4d35b658c16183c1a07d09ea2faf4bbac541 (diff) | |
| download | quickshell-9c00c48d9e2f0cb0c7cc56a4cac8f629012f40b0.tar.gz quickshell-9c00c48d9e2f0cb0c7cc56a4cac8f629012f40b0.zip | |
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.
Diffstat (limited to 'desktop/modules/bluetooth/BluetoothModule.qml')
| -rw-r--r-- | desktop/modules/bluetooth/BluetoothModule.qml | 15 |
1 files changed, 15 insertions, 0 deletions
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 { |
