Skip to content

Enable Bluetooth A2DP auto-connect in WirePlumber#5336

Open
dandresrp wants to merge 2 commits intobasecamp:devfrom
dandresrp:fix-bluetooth-a2dp-autoconnect
Open

Enable Bluetooth A2DP auto-connect in WirePlumber#5336
dandresrp wants to merge 2 commits intobasecamp:devfrom
dandresrp:fix-bluetooth-a2dp-autoconnect

Conversation

@dandresrp
Copy link
Copy Markdown

@dandresrp dandresrp commented Apr 17, 2026

Summary

  • add a default WirePlumber Bluetooth rule that auto-connects A2DP sink and source profiles
  • install the rule for new systems from the existing Bluetooth hardware config step
  • migrate existing installs and restart PipeWire so the rule applies immediately

Why

Issue #1818 currently recommends a local workaround that sets bluez5.auto-connect in monitor.bluez.properties, forces bluez5.roles = [ a2dp_source ], and disables device.restore-profile globally.

WirePlumber documents bluez5.auto-connect as a device property that should be applied through monitor.bluez.rules, and device.restore-profile as a global setting with default true.

This PR keeps the fix narrower: it only enables documented A2DP auto-connect on Bluetooth cards and avoids changing global profile restore behavior.

Validation

  • reproduced locally with a Bluetooth Echo Dot that connected but did not become an output device under stock Omarchy settings
  • applied the same rule locally in ~/.config/wireplumber/wireplumber.conf.d/
  • confirmed the device started appearing and working as an output without manual audio recovery
  • bash -n install/config/hardware/bluetooth.sh
  • bash -n migrations/1776346552.sh

Fixes #1818

Copilot AI review requested due to automatic review settings April 17, 2026 05:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a WirePlumber rule to auto-connect Bluetooth A2DP sink/source profiles so Bluetooth audio devices reliably expose playback/capture without manual recovery, and deploys it both for new installs and existing systems (via migration).

Changes:

  • Add a default WirePlumber monitor.bluez.rules drop-in enabling bluez5.auto-connect for A2DP.
  • Install the rule during the existing Bluetooth hardware config step for new systems.
  • Migrate existing installs by copying the drop-in and restarting audio services.

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 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
migrations/1776346552.sh Installs the new WirePlumber Bluetooth rule on existing installs and triggers a restart.
install/config/hardware/bluetooth.sh Ensures new installs get the WirePlumber Bluetooth A2DP auto-connect rule.
default/wireplumber/wireplumber.conf.d/bluetooth-a2dp-autoconnect.conf Defines the WirePlumber BlueZ rule that enables A2DP auto-connect on Bluetooth cards.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread migrations/1776346552.sh Outdated
Comment on lines +4 to +5
cp $OMARCHY_PATH/default/wireplumber/wireplumber.conf.d/bluetooth-a2dp-autoconnect.conf \
~/.config/wireplumber/wireplumber.conf.d/
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

This migration always overwrites an existing user rule file if it’s already present (e.g., a user may have created/tuned the same file as a workaround). Consider making this idempotent by only copying when the destination file doesn’t exist, or by backing up the existing file before overwriting it.

Suggested change
cp $OMARCHY_PATH/default/wireplumber/wireplumber.conf.d/bluetooth-a2dp-autoconnect.conf \
~/.config/wireplumber/wireplumber.conf.d/
destination=~/.config/wireplumber/wireplumber.conf.d/bluetooth-a2dp-autoconnect.conf
if [ ! -f "$destination" ]; then
cp "$OMARCHY_PATH/default/wireplumber/wireplumber.conf.d/bluetooth-a2dp-autoconnect.conf" \
"$destination"
fi

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in fbb1e2b. The migration now keeps an existing ~/.config/wireplumber/wireplumber.conf.d/bluetooth-a2dp-autoconnect.conf in place instead of overwriting a user workaround file.

Comment thread migrations/1776346552.sh Outdated
Comment on lines +4 to +7
cp $OMARCHY_PATH/default/wireplumber/wireplumber.conf.d/bluetooth-a2dp-autoconnect.conf \
~/.config/wireplumber/wireplumber.conf.d/

omarchy-restart-pipewire
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

If the cp fails (missing source file, permissions, etc.), the script will still likely exit successfully because omarchy-restart-pipewire runs afterwards and becomes the migration’s exit code. Add set -e (or explicitly check the cp result) so the migration reliably fails when the file cannot be installed.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in fbb1e2b. The migration now uses set -e, so a failed install of the WirePlumber drop-in stops the migration instead of being masked by the restart helper.

Comment thread migrations/1776346552.sh
cp $OMARCHY_PATH/default/wireplumber/wireplumber.conf.d/bluetooth-a2dp-autoconnect.conf \
~/.config/wireplumber/wireplumber.conf.d/

omarchy-restart-pipewire
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

This migration restarts pipewire.service only, but the new setting is a WirePlumber rule; restarting PipeWire alone may not reload WirePlumber configuration. To ensure the rule is applied immediately, also restart the WirePlumber user service (and, if needed, pipewire-pulse) or update the restart helper used here accordingly.

Suggested change
omarchy-restart-pipewire
systemctl --user restart wireplumber.service pipewire.service
if systemctl --user --quiet is-active pipewire-pulse.service; then
systemctl --user restart pipewire-pulse.service
fi

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in fbb1e2b. omarchy-restart-pipewire now restarts wireplumber.service and pipewire.service, and also restarts pipewire-pulse.service when it is active, so this migration reloads the new WirePlumber rule immediately.

@gcallant
Copy link
Copy Markdown

I tested this PR with a Bowers & Wilkins Px8 headset on latest Omarchy/PipeWire/WirePlumber. The A2DP auto-connect rule fixed profile exposure, but AVRCP resume still failed after the headset had been paused for more than ~5 seconds. That matched WirePlumber's default node suspend timeout.

Adding this Bluetooth output node rule fixed it:

  monitor.bluez.rules = [
    ...
    {
      matches = [
        { node.name = "~bluez_output.*" }
      ]
      actions = {
        update-props = {
          session.suspend-timeout-seconds = 0
        }
      }
    }
  ]

Validation:

  • wpctl inspect <Px8 sink> showed session.suspend-timeout-seconds = "0"
  • headset play/pause resumed reliably after >5s paused
  • kernel input events from the headset were arriving immediately, so the issue was not AVRCP input delivery

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.

Bluetooth Audio Devices Doesn't Work

3 participants