-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: add WirePlumber config for automatic Bluetooth audio switching #2072
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
feat: add WirePlumber config for automatic Bluetooth audio switching #2072
Conversation
Configure WirePlumber to automatically switch to Bluetooth audio devices when they connect, setting higher priority than internal audio devices. This ensures seamless audio switching when connecting Bluetooth headphones or other audio devices.
Nice! We're going to need a migration to copy this over on existing installs. |
Whoops, right - thanks @dhh! I created a migration, I hope it's ok the way I did it I'll ask a question since we're at it: are there any guidelines for contributing? E.g.: using the dev branch as base, ways to test migrations or changes or anything I might have missed (tried to search but didn't find them} |
We should make a contributors guide for sure. The branch thing is also something we should get cleaned up, so it's just the default is correct. There's a bit of backlog there! |
migrations/1759159162.sh
Outdated
echo "Enable automatic Bluetooth audio device switching" | ||
|
||
# Only apply if WirePlumber 0.5+ is installed | ||
if command -v wireplumber &> /dev/null; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can just do omarchy-pkg-add wireplumber
to ensure it's installed. Then we don't have to do the version test either.
Adds migration script to install WirePlumber configuration that automatically switches to Bluetooth audio devices when they connect. The migration: - Ensures WirePlumber is installed via omarchy-pkg-add - Installs the config if not already present - Preserves existing user configurations - Restarts WirePlumber to apply changes
6e861c5
to
6639000
Compare
Cool! Yeah just wanted to make sure I got things right as it's my first PR and I'd like to send more. Since I didn't find an issue for the contributors guide I went ahead and created one. I also amended the latest commit and applied the fix you mentioned about |
How does it compare to current behavior? I mean, my BT headphones already connect when I turn them on. |
Same question as @cluah. My wiremix setup (default) automatically switches to my BT device (Airpod Pro 2) once connected. What device(s), version, etc are you using @flaviolivolsi ? |
@cluah @iamobservable thanks for pointing this out! In my case the headphones do connect automatically but they don't become the active audio sink - at least on my fresh install, I still have to open wiremix and hit 'd' on the device to set it manually. Maybe this already works seamlessly on some hardware/setups? My PR just aims to automate that step making the behavior consistent with what worked for me. Here's some info about my setup:
The key difference might be that on fresh installs, WirePlumber has no stored preferences in What I'd like to achieve is consistent behavior by giving Bluetooth devices higher priority (2000 vs 1000 for internal audio), making the auto-switch work regardless of stored preferences - which matches what you're already experiencing. |
Thanks for sharing more information about the expectations. In the initial message, I did not see a mention of not having previously selected the device. My experience IS HAVING already manually selected the BT device and it later automatically switches on connection sync. Sounds like this is not the goal you had, but to allow for switching of any device immediately after Bluetooth connect. Thanks for clarifying. Now if I can just figure out how to use pipewire and airplay to connect to my devices on my home network! But that is another cliff to climb. 🤣 |
You're right, my initial description was unclear and this discussion also helped me frame it properly, thank you for that! Updating the PR description right away to be more specific about the problem and solution. And best of luck with your new quest! :D |
@flaviolivolsi i got it. do you know how i can get the current default behavior without reinstalling omarchy? |
Copying over |
Sorry I mean I want this:
I tried deleting “~/.local/state/wireplumber” and “/var/lib/bluetooth/,” but I'm not sure if I'm doing it. |
@flaviolivolsi I tried again using a fresh installation. Sinks: laptop's built-in speakers + two BT headphones. My Sony WH-1000 headphones automatically acquire audio after connecting them using the UI (Bluetooth icon on the top right). And it's the one listed in Then I tried to test the PR, but I couldn't get it to work. It kept showing 1010. I had to change this:
To this:
I was able to see the higher priority values, but I couldn't see a change in behavior. So at least in this case, where the priority of headphones is already higher than that of built-in speakers, increasing it seems to keep things the same. |
@cluah thanks for testing! I'll try again with a new install and let you know if I incur in the same issue |
The problem:
On a fresh Omarchy install, when a Bluetooth audio device connects, it does not automatically become the active audio sink. The user must manually open a tool like
wiremix
and select the device to route audio to it.This behavior seems to be caused by WirePlumber storing user preferences (
~/.local/state/wireplumber/default-nodes
), which can override the default device priorities on reconnection.The solution:
This PR makes the auto-switch behavior explicit and reliable by adding a WirePlumber configuration that gives newly connected Bluetooth devices a higher priority (2000) than the default for internal audio (1000).
The result:
With this change, any newly connected Bluetooth headset will immediately and automatically become the default input/output device. This provides a seamless "it just works" experience, consistent with the Omarchy philosophy, regardless of stored preferences or specific hardware.
(description edited for clarity - thx @iamobservable and @cluah)