Skip to content

Allow Bluetooth bar toggle when adapter is rfkill-blocked - #13655

Closed
AnPod wants to merge 1 commit into
omacom:quattrofrom
AnPod:cursor/fix-bluetooth-toggle-null-adapter-ef3e
Closed

AnPod wants to merge 1 commit into
omacom:quattrofrom
AnPod:cursor/fix-bluetooth-toggle-null-adapter-ef3e

Conversation

@AnPod

@AnPod AnPod commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes omacom/omarchy#13523: after turning Bluetooth off via the bar, omarchy-bluetooth-power rfkill-blocks the radio, BlueZ drops the controller from D-Bus, and Bluetooth.defaultAdapter becomes null. The panel's if (!adapter) return then made turn-on a silent no-op.

Changes

  • When the adapter is missing, toggleBluetooth() calls omarchy-bluetooth-power on
  • Keep the bar widget and power switch visible while rfkill-blocked
  • Show the off glyph / "Turned Off" state instead of an empty/"No adapter" UI

Test plan

  • ./test/shell.d/bluetooth-test.sh
  • Manually: turn BT off from the bar, then toggle it back on without using a terminal

Upstream

#13523

Once omarchy-bluetooth-power blocks the radio, BlueZ drops the controller
from D-Bus and defaultAdapter becomes null. Treat that as off, keep the
bar control visible, and turn the radio back on through the helper.

Co-authored-by: AnPod <AnPod@users.noreply.github.com>
@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for tracking this down. The diagnosis in #13523 is right: once the radio is blocked, the adapter can be null and the early return in toggleBluetooth() leaves no way back. Several other open pull requests fix the same bug in the panel, though, and this one isn't the one I'd recommend.

The problem is visible: true at shell/plugins/panels/bluetooth/Panel.qml:504, together with the power switch at :727 that is now always shown. On quattro the widget hides on machines with no Bluetooth hardware, the same way the power widget hides without a battery (visible: batteryPresent). With this change, every desktop without a Bluetooth controller gets a Bluetooth icon saying "Turned Off". So does a machine after its only USB dongle is unplugged, or one where bluetoothd has stopped. Clicking it runs omarchy-bluetooth-power on, which has no adapter to bring up.

#13204 does the same recovery but only keeps the widget when rfkill reports a blocked Bluetooth switch. That covers the null-adapter case, including a machine that boots with the block already restored by systemd-rfkill, and still hides the widget when there is no hardware. #12585 takes a similar approach with a bit more machinery. The root cause, the type-wide rfkill block bluetooth cutting power on ThinkPad and Dell platform switches (#7936), is addressed by #14104 and #12753. Those complement the panel fix rather than replace it.

What was checked: I read the diff against quattro and compared it with #13204, #12585, #12241, #13806, #10749 and #10003. Nothing was run on a worker, since the recommendation is a different pull request. Codex Medium was asked separately which of the panel fixes is best, without being given my answer. It also ranked #13204 first and #12585 second, and found the same over-broad visibility here. Its independence is not guaranteed.

Next step: the choice between these competing fixes is the maintainer's.

@omarchybot

Copy link
Copy Markdown
Collaborator

Thank you for this, @AnPod. #13204 got there first with a fix for the same problem, so this is closed in favour of it, and the credit stays with the first fix. If it does not cover your case, please say so there.

Closed at the maintainer's request. The review comment above has the details; it was done by Claude Opus 5.5 with Codex Medium as a second opinion, whose agreement is not independent.

@omarchybot omarchybot closed this Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bluetooth bar toggle can't turn Bluetooth back on once it's off (adapter becomes null)

3 participants