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/BluetoothPage.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/BluetoothPage.qml')
| -rw-r--r-- | desktop/modules/bluetooth/BluetoothPage.qml | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/desktop/modules/bluetooth/BluetoothPage.qml b/desktop/modules/bluetooth/BluetoothPage.qml index c608d82..26cb0ef 100644 --- a/desktop/modules/bluetooth/BluetoothPage.qml +++ b/desktop/modules/bluetooth/BluetoothPage.qml @@ -124,4 +124,56 @@ Column { width: page.width } } + + // --- Available (found while scanning, not yet paired) --- + + Text { + width: page.width + visible: page.bt.availableDevices.length > 0 + text: "Available" + font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2; bold: true } + color: Theme.subtext + } + + Repeater { + model: page.bt.availableDevices + + Rectangle { + required property var modelData + + width: page.width + implicitHeight: availText.implicitHeight + 16 + radius: 8 + color: Qt.alpha(Theme.surface, 0.35) + + Text { + id: availText + anchors { left: parent.left; leftMargin: 10; verticalCenter: parent.verticalCenter } + width: parent.width - pairBtn.width - 28 + elide: Text.ElideRight + text: page.bt.pairing.busy && page.bt.pairing.address === modelData.address + ? "Pairing…" + : (modelData.name || modelData.deviceName || modelData.address) + font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 } + color: Theme.text + } + + Button { + id: pairBtn + anchors { right: parent.right; rightMargin: 8; verticalCenter: parent.verticalCenter } + text: "Pair" + enabled: !page.bt.pairing.busy + onClicked: page.bt.pairing.pair(modelData.address) + } + } + } + + Text { + width: page.width + visible: page.bt.pairing.error !== "" + wrapMode: Text.Wrap + text: page.bt.pairing.error + font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 3 } + color: Theme.red + } } |
