Repository navigation
Conversation
…s D-Bus Some adapters disappear from BlueZ entirely while blocked, such as ThinkPad radios whose platform switch cuts their power. Bluetooth.defaultAdapter then goes null, and the panel treated that as having no Bluetooth at all: the bar icon hid itself and toggleBluetooth returned early, so Bluetooth turned off from the bar could only be turned back on from a terminal. The panel now follows the rfkill switches through `rfkill event`, which outlive the adapter, and treats a blocked Bluetooth switch as Bluetooth that is off rather than absent. Fixes omacom#13523 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #13523.
Some Bluetooth adapters disappear from BlueZ entirely while they're rfkill-blocked. On ThinkPads, for example, the platform switch cuts power to the USB radio. When that happens
Bluetooth.defaultAdaptergoesnull, and the panel treated that as "no Bluetooth hardware":visible: adapter !== null)toggleBluetooth()returned early on!adapter, so right-click, the panel switch, thebkey and theomarchy.bluetooth toggleBluetoothIPC all did nothingSo once Bluetooth was turned off from the bar, the only way to turn it back on was
omarchy-bluetooth-power onin a terminal.Change
The rfkill switch outlives the adapter, so the panel now follows it. A single
rfkill eventprocess reports every switch when it starts and each change after that, with no polling.Model.withRfkillEvent()folds those lines into a map of Bluetooth switches, and a blocked one makes the panel treat Bluetooth as off rather than absent:available(adapter present, or a Bluetooth switch blocked) drives the widget's visibility, the switch and the "No adapter" textspoweredOn(adapter present and enabled) drives the icon, the switch state and the toggle direction, so with no adapter the toggle asksomarchy-bluetooth-power onMachines with no Bluetooth radio at all still hide the widget as before.
Testing
test/shell.d/bluetooth-test.sh: new assertions for the rfkill event parser (Wi-Fi switches ignored, a platform switch still counting after the adapter's own switch is removed, hard blocks, unblocking, junk lines) and for the panel wiring. The old toggle assertion now fails against the previous code../test/shell: the 7 failures on this branch are identical to the 7 onquattrowithout the change (cache, kernel headers, browser focus, portal fixture,omasnap, the ShellIpc registration check). They're environment-related or pre-existing.bluetooth.service:toggleBluetoothIPC left the radio blocked.bkey and the IPC unblocked the radio.I haven't tested on ThinkPad hardware with a platform switch myself. A confirmation from the reporter would be welcome.
🤖 Generated with Claude Code