Skip to content

Show Bluetooth pairing codes in the Omarchy panel - #9965

Closed
Zhaoyikaiii wants to merge 1 commit into
omacom:quattrofrom
Zhaoyikaiii:fix/bluetooth-passkey-agent
Closed

Zhaoyikaiii wants to merge 1 commit into
omacom:quattrofrom
Zhaoyikaiii:fix/bluetooth-passkey-agent

Conversation

@Zhaoyikaiii

Copy link
Copy Markdown

Summary

  • replace the unmaintained bt-agent process with a BlueZ org.bluez.Agent1 service using the existing python-gobject base dependency
  • bridge passkey, PIN, confirmation, authorization, cancel, and timeout events to the Quickshell Bluetooth panel over a per-user Unix socket
  • display zero-padded six-digit passkeys and provide keyboard/mouse controls for confirmation and input requests
  • remove the obsolete bluez-tools package dependency

Fixes #8485
Related to #9676

Testing

  • bash test/shell
  • Python Agent1 callback and socket protocol smoke tests
  • QML lint with the repository Bluetooth panel dependencies

@n0mahd

n0mahd commented Sep 15, 2026

Copy link
Copy Markdown

One lifecycle edge is worth covering in this replacement agent: a registered Agent1 object becomes stale when bluetoothd is replaced even if the agent process itself remains healthy.

I reproduced this on an M1 MacBook Air with BlueZ 5.87. The agent process registered at 09:10:14, BlueZ restarted at 09:37:56, and the unchanged agent process remained active while subsequent pairing logged No agent available for request type 2 / Operation not permitted. Restarting the agent against the new org.bluez owner restored both a Logitech K850 and MX Master 3S.

From the current diff, RegisterAgent / RequestDefaultAgent happen once during initialization and Release does not trigger registration against a replacement owner. Please consider handling org.freedesktop.DBus.NameOwnerChanged for org.bluez (or otherwise exiting so systemd restarts the service). #11936 documents the real-hardware trace and #11937 adds that lifecycle handling for the existing agent.

@GruperTal

Copy link
Copy Markdown

Thanks for this. I hit the same problem pairing a Logitech MX Mechanical (#8485), and before finding this PR I put together a smaller, opt-in variant:

https://github.com/GruperTal/omarchy/tree/bluetooth-pairing-prompt

  • The default doesn't change: with the toggle off, bt-agent -c NoInputNoOutput runs exactly as it does today.
  • A toggle (Trigger > Toggle > Bluetooth Pairing Codes) switches bt-agent.service to a small KeyboardDisplay Agent1. Passkeys and PINs are shown in a notification, and confirmation and PIN entry go through the existing omarchy-menu-select / omarchy-menu-input. There are no QML changes and no new dependencies (python-gobject).
  • It includes a test that runs the agent against a fake BlueZ on a private bus.

It's about 200 lines for the agent, compared with the full panel integration here. Would an opt-in approach like this be useful, either alongside this PR or as a first step? If it is, I'm happy to open it as a PR or fold parts into this one. If this PR is the preferred direction, I'll leave it here.

@Zhaoyikaiii

Copy link
Copy Markdown
Author

Thanks for this. I hit the same problem pairing a Logitech MX Mechanical (#8485), and before finding this PR I put together a smaller, opt-in variant:

https://github.com/GruperTal/omarchy/tree/bluetooth-pairing-prompt

  • The default doesn't change: with the toggle off, bt-agent -c NoInputNoOutput runs exactly as it does today.
  • A toggle (Trigger > Toggle > Bluetooth Pairing Codes) switches bt-agent.service to a small KeyboardDisplay Agent1. Passkeys and PINs are shown in a notification, and confirmation and PIN entry go through the existing omarchy-menu-select / omarchy-menu-input. There are no QML changes and no new dependencies (python-gobject).
  • It includes a test that runs the agent against a fake BlueZ on a private bus.

It's about 200 lines for the agent, compared with the full panel integration here. Would an opt-in approach like this be useful, either alongside this PR or as a first step? If it is, I'm happy to open it as a PR or fold parts into this one. If this PR is the preferred direction, I'll leave it here.

Thanks for putting this together, @GruperTal. I'm happy to go with your smaller, opt-in approach as a first step. Keeping the default behavior unchanged and reusing the existing notification/menu UI makes sense to me.
The main blocker right now is that this PR hasn't received any maintainer review or follow-up yet. I'm happy to adapt it to your proposal, but we still need a maintainer to weigh in on the preferred direction—whether to incorporate your approach here or move forward with a separate PR.

@guisaliba

guisaliba commented Oct 15, 2026 •

Copy link
Copy Markdown

+1 on this, still an issue. PR author is waiting for a reviewer/maintainer to opinate on whether to take their proposal or @GruperTal's.

I still didn't have time to review any of the implementations, so I couldn't even give my own take on this.

@Battlelamb

Copy link
Copy Markdown

Cross-project integration request for this existing fix (not a competing PR): AyushKr2003/omacale#33. Omacale renders its own Bluetooth settings/popout but dispatches Omarchy's omarchy-bluetooth-device helper, so a prompt implemented only inside the stock Bluetooth panel may not be visible while bar.id = "omacale.bar".

Please expose pairing authentication through a shell-wide prompt/notification or a documented request/response interface that third-party bars can consume, or document the required integration. Desired check: an Omacale user can see the six-digit code, type it on a BLE HID keyboard and press Enter, and receive success/failure/cancel feedback without switching bars or opening a terminal.

Hardware control case: a Logitech Pebble Keys 2 K380s on Intel AX211 paired with an interactive bluetoothctl --agent KeyboardDisplay; we verified paired/bonded/trusted/connected, Hyprland input registration, and the user confirmed typing. The stock NoInputNoOutput service was left running. Omarchy 4.0.4-1.1 locally rebuilt, Quickshell 0.3.1-1.2, BlueZ 5.87-2, Omacale installed manifest 0.44.0 with local customizations. This is a successful CLI control, not a test of this PR or a clean-current-Omacale reproduction. The user's separate missing connection-display report is in the linked issue.

The full sanitized evidence is being added to #8485. Thank you for keeping this existing fix as the place to coordinate the agent work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quickshell Bluetooth panel cannot pair devices that require a displayed passkey

6 participants