Skip to content

control-center: route Bluetooth power toggles through DMS backend - #3082

Open
alamin147 wants to merge 1 commit into
AvengeMedia:masterfrom
alamin147:feature/bluetooth-rfkill-recovery
Open

control-center: route Bluetooth power toggles through DMS backend#3082
alamin147 wants to merge 1 commit into
AvengeMedia:masterfrom
alamin147:feature/bluetooth-rfkill-recovery

Conversation

@alamin147

@alamin147 alamin147 commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Description

The Control Center previously toggled BluetoothService.adapter.enabled directly, bypassing DMS’s Bluetooth backend.

This change routes Bluetooth power toggles through bluetooth.setPowered whenever the DMS Bluetooth capability is available. The backend already attempts soft-rfkill unblocking before enabling the BlueZ adapter, making recovery automatic and invisible to the user.

If the backend is unavailable, it falls back to the Quickshell Bluetooth adapter.

What changed

  • Added BluetoothService.setBluetoothEnabled()
  • Routed the existing Control Center toggle through the DMS backend
  • Logs backend failures
  • Preserves the direct adapter fallback
  • Adds no prompts, external commands, or visual changes

Testing

  • make lint-qml passes
  • git diff --check passes
  • Quickshell configuration loads without new errors
  • Tested in the active DMS installation

@bbedward

bbedward commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

We have soft rfkill unblocking built in, it can be instantiated when toggling device maybe instead

function setBluetoothEnabled(enabled) {
    if (DMSService.isConnected && DMSService.capabilities.includes("bluetooth")) {
        DMSService.sendRequest("bluetooth.setPowered", { powered: enabled }, ...)
        return
    }
    if (adapter)
        adapter.enabled = enabled
}

It may require udev rules since its unprivileged (or just being in bluetooth group on some distros), but maybe we can build escalation into the existing infra instead of executing external commands like pkexec. Kinda similar to CUPS service but not exactly since cups itself is the one that raises privilege escalation.

I'd rather make rfkill unblocking a behind the scenes event than a user-prompted event though, that can fail and log if it doesnt succeed. Since from my POV at least, if I want to use a bluetooth adapter rfkill unblocking is something I just expect to be done implicitly.

@alamin147

Copy link
Copy Markdown
Contributor Author

Yeah I understand. I will look into it and implement built in system

@alamin147
alamin147 force-pushed the feature/bluetooth-rfkill-recovery branch from 6ffd8af to 610acfa Compare August 16, 2026 05:12
@alamin147 alamin147 changed the title control-center: add Bluetooth rfkill recovery action control-center: route Bluetooth power toggles through DMS backend Aug 16, 2026
@alamin147

Copy link
Copy Markdown
Contributor Author

Thanks, agreed. I updated the PR to route the normal Bluetooth toggle through bluetooth.setPowered, with the Quickshell adapter as fallback. This uses the existing implicit soft-rfkill handling and removes the button and pkexec command. The branch is rebased and lint passes. @bbedward

@marcusramberg marcusramberg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm. Was actually just chasing why control center wasn't unblocking rfkill, so very happy to see someone else already chasing it. 😀

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants