Enable Bluetooth A2DP auto-connect in WirePlumber#5336
Enable Bluetooth A2DP auto-connect in WirePlumber#5336dandresrp wants to merge 2 commits intobasecamp:devfrom
Conversation
There was a problem hiding this comment.
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.rulesdrop-in enablingbluez5.auto-connectfor 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.
| cp $OMARCHY_PATH/default/wireplumber/wireplumber.conf.d/bluetooth-a2dp-autoconnect.conf \ | ||
| ~/.config/wireplumber/wireplumber.conf.d/ |
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
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.
| cp $OMARCHY_PATH/default/wireplumber/wireplumber.conf.d/bluetooth-a2dp-autoconnect.conf \ | ||
| ~/.config/wireplumber/wireplumber.conf.d/ | ||
|
|
||
| omarchy-restart-pipewire |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| cp $OMARCHY_PATH/default/wireplumber/wireplumber.conf.d/bluetooth-a2dp-autoconnect.conf \ | ||
| ~/.config/wireplumber/wireplumber.conf.d/ | ||
|
|
||
| omarchy-restart-pipewire |
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
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.
|
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:
|
Summary
Why
Issue #1818 currently recommends a local workaround that sets
bluez5.auto-connectinmonitor.bluez.properties, forcesbluez5.roles = [ a2dp_source ], and disablesdevice.restore-profileglobally.WirePlumber documents
bluez5.auto-connectas a device property that should be applied throughmonitor.bluez.rules, anddevice.restore-profileas a global setting with defaulttrue.This PR keeps the fix narrower: it only enables documented A2DP auto-connect on Bluetooth cards and avoids changing global profile restore behavior.
Validation
~/.config/wireplumber/wireplumber.conf.d/bash -n install/config/hardware/bluetooth.shbash -n migrations/1776346552.shFixes #1818