Repository navigation
Conversation
ConditionPathIsDirectory=/sys/class/bluetooth skips bt-agent forever when the adapter sysfs node is missing at graphical-session start. USB adapters (Broadcom on Intel MacBooks, dongles) often appear a few seconds later, so the Omarchy Bluetooth panel's bluetoothctl pair fails with "No agent available". Wait for bluetoothd and sysfs, then exec bt-agent. Exit 0 if nothing shows up so machines without Bluetooth do not restart-loop.
There was a problem hiding this comment.
Pull request overview
Adds a bounded startup wrapper so the BlueZ pairing agent can handle adapters appearing after login.
Changes:
- Waits up to 60 seconds for Bluetooth readiness.
- Reloads and restarts existing user services.
- Adds service configuration and shell tests.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
bin/omarchy-bluetooth-agent-start |
Adds bounded readiness polling before launching the agent. |
default/systemd/user/bt-agent.service |
Replaces permanently skipping conditions with the wrapper. |
migrations/1787815267.sh |
Reloads and restarts the updated user service. |
test/shell.d/bluetooth-test.sh |
Tests wrapper startup outcomes. |
test/shell.d/systemd-test.sh |
Verifies the updated unit configuration. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| # at graphical-session start (Broadcom on Intel MacBooks, USB dongles). Reload | ||
| # so the user manager picks up the wait-then-exec wrapper, then bounce a live | ||
| # or skipped agent. Login starts it for everyone else. | ||
| systemctl --user daemon-reload |
| [[ ! -s $device_tmp/agent-ran ]] || fail "pairing agent is not started without an adapter" | ||
| pass "pairing agent start exits 0 when no adapter appears" | ||
|
|
||
| # Adapter already present: exec bt-agent immediately. |
|
Automated duplication check: this pull request looks similar to #9131, which covers the same Bluetooth agent wait. I keep that one open and close this one to consolidate review. If you feel this is the wrong decision, please open the PR again with a note on the difference. |
What
The session
bt-agentno longer skips forever when/sys/class/bluetoothis missing at login. It waits for bluetoothd and the adapter sysfs node, then registers as the default pairing agent. If nothing appears, it exits 0 so machines without Bluetooth do not restart-loop.Why
Omarchy's Bluetooth panel pairs with
bluetoothctl pair. That needs a registered BlueZ agent. The user unit usedConditionPathIsDirectory=/sys/class/bluetoothplusExecCondition=onbluetooth.service. A failed Condition/ExecCondition skips the unit;Restart=does not apply.On a MacBookPro12,1 (Broadcom USB adapter) that looks like:
Then pairing from Super+Ctrl+B logs:
Reproduced pairing Logitech MX Anywhere 3S and Pebble Keys 2 K380s. They advertised fine; the GUI could not confirm the passkey because no agent was running.
bluetoothctl --agent NoInputNoOutput pair …succeeded immediately.Related
This is separate from the trusted-but-unpaired state machine (#7879 / #7880) and from showing keyboard passkeys (#8485 / #6877). Those still matter. Even with them, this skip leaves the panel with no agent on late USB adapters.
#6877 keeps
ConditionPathIsDirectory=/sys/class/bluetooth, so it would still skip on this hardware.Test
bash test/shell.d/bluetooth-test.shbash test/shell.d/systemd-test.sh./test/cli./test/all: bluetooth/systemd tests pass. Remaining failures (config,launch-about,snapper,unowned-system-paths, plus flakytheme-install-guards/runtime-smoke) also fail onquattrohere without this change (missingomarchy-pkgscheckout / compositor).