Persist Pipewire Audio Profiles with Wireplumber

When setting up my new laptop, using Wayland/Sway, I noticed that whenever my bluetooth headset would connect, my microphone didn’t work.

This comes from an audio profile being selected which doesn’t work as a source.

You can see the configured profile using pavucontrol.

Moreover, If you check the configured profiles in the terminal using pactl, you can see that all the a2dp profiles don’t support any “input”, meaning microphones won’t work.

# display available audio cards
> pactl list cards
...
Card #177
	Name: bluez_card.F4_B6_88_BE_7B_1A
	Driver: module-bluez5-device.c
	Owner Module: n/a
	Properties:
		...
	Profiles:
		off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
		headset-head-unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 1, available: yes)
		a2dp-sink-sbc: High Fidelity Playback (A2DP Sink, codec SBC) (sinks: 1, sources: 0, priority: 18, available: yes)
		a2dp-sink-sbc_xq: High Fidelity Playback (A2DP Sink, codec SBC-XQ) (sinks: 1, sources: 0, priority: 17, available: yes)
		a2dp-sink-aac: High Fidelity Playback (A2DP Sink, codec AAC) (sinks: 1, sources: 0, priority: 19, available: yes)
		a2dp-sink-aptx: High Fidelity Playback (A2DP Sink, codec aptX) (sinks: 1, sources: 0, priority: 20, available: yes)
		a2dp-sink: High Fidelity Playback (A2DP Sink, codec aptX HD) (sinks: 1, sources: 0, priority: 21, available: yes)
		headset-head-unit-cvsd: Headset Head Unit (HSP/HFP, codec CVSD) (sinks: 1, sources: 1, priority: 2, available: yes)
		headset-head-unit-msbc: Headset Head Unit (HSP/HFP, codec mSBC) (sinks: 1, sources: 1, priority: 3, available: yes)
	Active Profile: a2dp-sink-aptx

Manually changing the profile in pavucontrol did work, but it did not remember when reconnecting with bluetooth again.

However there is a package which will persist the selected configuration for you called wireplumber.

# install wireplumber
sudo pacman -S wireplumber
 
# restart pipewire
systemctl --user restart pipewire
systemctl --user restart pipewire-pulse

From PipeWire - ArchWiki