Request addition to pipewire config - auto switch

Report Bugs, Issues and non- package Requests
Message
Author
User avatar
CharlesV
Global Moderator
Posts: 7493
Joined: Sun Jul 07, 2019 5:11 pm

Request addition to pipewire config - auto switch

#1 Post by CharlesV »

The following method turns on auto switch for newly connected bluetooth devices under XFCE. I have been using this in several MX23 xfce machines, just worked with a gent to fix his too and he recommended we add it.

It is so useful, I have had it working since MX23 ( different fix for MX21 ) and would like to request it to be added to the pipewire config. If for some reason we cannot, then possibly added to MX Tweak.

-- To get auto switch working on bluetooth in XFCE with pipewire,
Modify:

Code: Select all

/usr/share/pipewire/pipewire-pulse.conf

And under the group of:

Code: Select all

  content.exec:

Add this line:

Code: Select all

    { path = "pactl" args = "load-module module-switch-on-connect" }

Restart the computer and bluetooth devices should now automatically switch to a bluetooth device when connected.
*QSI = Quick System Info from menu (Copy for Forum)
*MXPI = MX Package Installer
*Please check the solved checkbox on the post that solved it.
*Linux -This is the way!

User avatar
dolphin_oracle
Developer
Posts: 22319
Joined: Sun Dec 16, 2007 12:17 pm

Re: Request addition to pipewire config - auto switch

#2 Post by dolphin_oracle »

CharlesV wrote: Tue Jan 02, 2024 12:13 pm The following method turns on auto switch for newly connected bluetooth devices under XFCE. I have been using this in several MX23 xfce machines, just worked with a gent to fix his too and he recommended we add it.

It is so useful, I have had it working since MX23 ( different fix for MX21 ) and would like to request it to be added to the pipewire config. If for some reason we cannot, then possibly added to MX Tweak.

-- To get auto switch working on bluetooth in XFCE with pipewire,
Modify:

Code: Select all

/usr/share/pipewire/pipewire-pulse.conf

And under the group of:

Code: Select all

  content.exec:

Add this line:

Code: Select all

    { path = "pactl" args = "load-module module-switch-on-connect" }

Restart the computer and bluetooth devices should now automatically switch to a bluetooth device when connected.
to survive updates, probably put a copy of that .conf file under /etc/pipewire or ~/.config/pipewire.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
CharlesV
Global Moderator
Posts: 7493
Joined: Sun Jul 07, 2019 5:11 pm

Re: Request addition to pipewire config - auto switch

#3 Post by CharlesV »

Good call.. and thank you !
*QSI = Quick System Info from menu (Copy for Forum)
*MXPI = MX Package Installer
*Please check the solved checkbox on the post that solved it.
*Linux -This is the way!

User avatar
dolphin_oracle
Developer
Posts: 22319
Joined: Sun Dec 16, 2007 12:17 pm

Re: Request addition to pipewire config - auto switch

#4 Post by dolphin_oracle »

will make the change tonight on my machine and see how it behaves.

does this only work for bluetooth, or also for other connections? thinking mostly about hdmi connections, but also usb headsets and such.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
CharlesV
Global Moderator
Posts: 7493
Joined: Sun Jul 07, 2019 5:11 pm

Re: Request addition to pipewire config - auto switch

#5 Post by CharlesV »

dolphin_oracle wrote: Tue Jan 02, 2024 1:37 pm will make the change tonight on my machine and see how it behaves.

does this only work for bluetooth, or also for other connections? thinking mostly about hdmi connections, but also usb headsets and such.
I have only used it on bluetooth, and dont have any monitors with with speakers to try it on. I found this and the same fix for pulse audio that I used in MX 21 here:

MX 23 - Pipewire
https://alexandra-zaharia.github.io/pos ... -in-linux/
( scroll down a bit )

and
MX 21 - Pulseaudio
https://alexandra-zaharia.github.io/pos ... lly-linux/

Been so long since I did them I totally forgot until the latest post I worked on.
*QSI = Quick System Info from menu (Copy for Forum)
*MXPI = MX Package Installer
*Please check the solved checkbox on the post that solved it.
*Linux -This is the way!

User avatar
m_pav
Developer
Posts: 1803
Joined: Sun Aug 06, 2006 3:02 pm

Re: Request addition to pipewire config - auto switch

#6 Post by m_pav »

Not that it makes any difference in function, but shouldn't the line to add into pipewire.conf follow the conventions already used?

{ path = "/usr/bin/pactl" args = "load-module module-switch-on-connect" }
instead of
{ path = "pactl" args = "load-module module-switch-on-connect" }

and I agree with DO
dolphin_oracle wrote: Tue Jan 02, 2024 12:51 pm to survive updates, probably put a copy of that .conf file under /etc/pipewire or ~/.config/pipewire.
Mike P

Regd Linux User #472293
(Daily) Lenovo T560, i7-6600U, 16GB, 2.0TB SSD, MX_ahs
(ManCave) AMD Ryzen 5 5600G, 32G, 8TB mixed, MX_ahs
(Spare)2017 Macbook Air 7,2, 8GB, 256GB SSD, MX_ahs

User avatar
Stevo
Developer
Posts: 14631
Joined: Fri Dec 15, 2006 7:07 pm

Re: Request addition to pipewire config - auto switch

#7 Post by Stevo »

None of the commented-out examples already in the file use the full /usr/bin path, though.
MXPI = MX Package Installer
QSI = Quick System Info from menu
The MX Test repository is mostly backports; not the same as Debian testing

User avatar
AVLinux
Posts: 3012
Joined: Wed Jul 15, 2020 1:15 am

Re: Request addition to pipewire config - auto switch

#8 Post by AVLinux »

@dolphin_oracle

Would it be better as an auxiliary package instead of part of pipewire-setup-mx? Supposing it was a separate package called something like 'pipewire-bluetooth-mx' and instead of placing the conf files in /usr/share/pipewire where they could get overwritten it could place the modified conf file directly into /etc/pipewire where it would be safe.. People with bluetooth devices could install it and people without could just have the stock PipeWire setup in case the auto switch does unwanted things with normal Audio devices..?

User avatar
Stevo
Developer
Posts: 14631
Joined: Fri Dec 15, 2006 7:07 pm

Re: Request addition to pipewire config - auto switch

#9 Post by Stevo »

AVLinux wrote: Tue Jan 02, 2024 6:46 pm @dolphin_oracle

Would it be better as an auxiliary package instead of part of pipewire-setup-mx? Supposing it was a separate package called something like 'pipewire-bluetooth-mx' and instead of placing the conf files in /usr/share/pipewire where they could get overwritten it could place the modified conf file directly into /etc/pipewire where it would be safe.. People with bluetooth devices could install it and people without could just have the stock PipeWire setup in case the auto switch does unwanted things with normal Audio devices..?
If we wanted to make it opt-in, or default with an opt-out, I'd vote for having the setting in MX Tweak.
MXPI = MX Package Installer
QSI = Quick System Info from menu
The MX Test repository is mostly backports; not the same as Debian testing

User avatar
dolphin_oracle
Developer
Posts: 22319
Joined: Sun Dec 16, 2007 12:17 pm

Re: Request addition to pipewire config - auto switch

#10 Post by dolphin_oracle »

I need to think about it. I'm inclined to make a switch for it.

FWIW, this affects all connected audio devices, not just bluetooth ones. its quit irritating when pluggin in a microphone to have all your audio switch to the mic, even the output. I'm going to guess that it might be similar for other types of connections, maybe even HDMI audio, although I haven't tested that.

does work though.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

Post Reply

Return to “Bugs and Non-Package Requests Forum”