Skip to content

Protect active Bluetooth audio from panel discovery - #7385

Open
lbonvarl wants to merge 1 commit into
basecamp:quattrofrom
lbonvarl:agent/protect-bluetooth-audio
Open

Protect active Bluetooth audio from panel discovery#7385
lbonvarl wants to merge 1 commit into
basecamp:quattrofrom
lbonvarl:agent/protect-bluetooth-audio

Conversation

@lbonvarl

@lbonvarl lbonvarl commented Aug 18, 2026

Copy link
Copy Markdown

Problem

#6794 fixed the discovery session that survived after the Bluetooth panel closed, but the panel still starts inquiry immediately while a Bluetooth audio sink is connected. On controllers that cannot scan and sustain A2DP reliably at the same time, audio stutters or pauses for as long as the panel remains open.

The existing retry loop only considers panel, adapter, and discovery state. It does not consider the PipeWire sink already using the controller.

Fixes #7384.

What changed

  • Track the default PipeWire sink so its lazy node metadata is available before making the discovery decision.
  • Detect Bluetooth audio from either the default sink metadata or an existing connected-device/sink match.
  • Keep automatic discovery disabled while a Bluetooth audio sink exists.
  • Stop a panel-owned scan when a Bluetooth sink appears after a connection completes.
  • Show Audio protected in the hero and add an Omarchy-style Scan anyway action.
  • Make the override session-scoped: it can be stopped manually and always returns to protected behavior when the panel closes.
  • Keep a manually stopped scan down for the rest of the panel session, even if the sink briefly disappears during a Bluetooth transition.
  • Add the action to the existing shared keyboard/mouse cursor model.

Behavior

With Bluetooth audio connected:

  1. Opening the panel does not start discovery.
  2. Scan anyway starts discovery explicitly and changes to Stop scanning.
  3. The secondary copy warns that the one-time scan may interrupt audio.
  4. Stopping manually or closing the panel ends the panel-owned discovery session.

Without a Bluetooth audio sink, the existing automatic discovery behavior is unchanged.

Validation

  • qmllint -I shell shell/plugins/panels/bluetooth/Panel.qml
  • bash test/shell.d/bluetooth-test.sh
  • Restarted the running shell and inspected full-screen captures of both protected and forced-scan states for clipping, overlap, spacing, stale state, and focus regressions.
  • Exercised the action through the panel keyboard cursor with wtype as well as by pointer.
  • Live A2DP checks:
    • protected panel open kept Discovering: no
    • explicit scan changed discovery to yes
    • manual stop returned discovery to no without retrying
    • closing during an explicit scan returned discovery to no
    • the Bluetooth device remained connected and the PipeWire playback stream remained active
  • ./test/all: 179 of 180 shell test files passed in the full desktop run. runtime-smoke-test.sh hit a transient IPC-handler count mismatch against the already-running shell; its immediate standalone rerun passed completely.

The Bluetooth regression test now covers sink tracking, audio-aware retry gating, the explicit override, manual-stop suppression, and close-time reset.

Skip automatic Bluetooth discovery while PipeWire reports a connected Bluetooth audio sink. Add a session-only scan override for pairing another device, with explicit interruption copy and close-time cleanup.

Fixes basecamp#7384
@lbonvarl
lbonvarl force-pushed the agent/protect-bluetooth-audio branch from 158d550 to 9cf894c Compare August 18, 2026 13:14
@lbonvarl
lbonvarl marked this pull request as ready for review August 19, 2026 14:23
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.

Protect active Bluetooth audio from panel discovery

1 participant