Request addition to pipewire config - auto switch

Report Bugs, Issues and non- package Requests
Message
Author
User avatar
AVLinux
Posts: 3008
Joined: Wed Jul 15, 2020 1:15 am

Re: Request addition to pipewire config - auto switch

#11 Post by AVLinux »

dolphin_oracle wrote: Tue Jan 02, 2024 8:21 pm
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.
Eeegads!

That gives me cold sweats in a Studio context... :confused:

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

Re: Request addition to pipewire config - auto switch

#12 Post by CharlesV »

dolphin_oracle wrote: Tue Jan 02, 2024 8:21 pm 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.
Makes sense that it is setup to switch any audio device... but I think I would agree with you about making a switch for it.

The plus side is behaving like that it would be excellent for plugging in an hdmi, connecting a bluetooth speaker.. those seem very 'normal' to me ...

But at the risk of messing people up with other devices, like what your describing, or heavy audio connections... a switch to turn that feature off would be good.
*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
CharlesV
Global Moderator
Posts: 7479
Joined: Sun Jul 07, 2019 5:11 pm

Re: Request addition to pipewire config - auto switch

#13 Post by CharlesV »

Maybe we can learn something from how KDE does this?

I will fire up a KDE test machine tomorrow and see if I can find out how that happens. My understanding is that KDE auto switches to bluetooth when it connects but obviously xfce does not.
*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
Stevo
Developer
Posts: 14625
Joined: Fri Dec 15, 2006 7:07 pm

Re: Request addition to pipewire config - auto switch

#14 Post by Stevo »

I can confirm that MX 21 and 23 KDE do switch automatically, and if I connect yet another BT earphone or speaker on top of the existing, they switch to the new one. And switch back if that new device is disconnected.

I wonder if this has come up on the XFCE forums yet, or if another XFCE distro has addressed this annoyance.
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
CharlesV
Global Moderator
Posts: 7479
Joined: Sun Jul 07, 2019 5:11 pm

Re: Request addition to pipewire config - auto switch

#15 Post by CharlesV »

In my search before when mx23 was in beta stages, I found several places complaining about it, but only that link I posted had 'the fix' (and on the Arch website.)

In looking around this am I found a few more sites complaining about it, but not a lot and no mention of it on the xfce forum that I could find.
*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
CharlesV
Global Moderator
Posts: 7479
Joined: Sun Jul 07, 2019 5:11 pm

Re: Request addition to pipewire config - auto switch

#16 Post by CharlesV »

You all probably already know this, but I compared MX 23 KDE and XFCE pipewire configs (identical ) , yet the KDE version works perfectly switching to a connected bluetooth device.

I tried work through configs etc and I cannot see anything that is different that would do this. Yet... it does ;-/
*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: 22306
Joined: Sun Dec 16, 2007 12:17 pm

Re: Request addition to pipewire config - auto switch

#17 Post by dolphin_oracle »

CharlesV wrote: Wed Jan 03, 2024 7:03 pm You all probably already know this, but I compared MX 23 KDE and XFCE pipewire configs (identical ) , yet the KDE version works perfectly switching to a connected bluetooth device.

I tried work through configs etc and I cannot see anything that is different that would do this. Yet... it does ;-/
unlike Xfce, KDE itself has a daemon that manages connections. gnome probably does too.
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: 7479
Joined: Sun Jul 07, 2019 5:11 pm

Re: Request addition to pipewire config - auto switch

#18 Post by CharlesV »

dolphin_oracle wrote: Wed Jan 03, 2024 7:19 pm
CharlesV wrote: Wed Jan 03, 2024 7:03 pm You all probably already know this, but I compared MX 23 KDE and XFCE pipewire configs (identical ) , yet the KDE version works perfectly switching to a connected bluetooth device.

I tried work through configs etc and I cannot see anything that is different that would do this. Yet... it does ;-/
unlike Xfce, KDE itself has a daemon that manages connections. gnome probably does too.
That would make sense.
*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
mxUs3r
Posts: 4
Joined: Fri Mar 22, 2024 2:29 pm

Re: Request addition to pipewire config - auto switch

#19 Post by mxUs3r »

Posting the updated version of the solution as in "/usr/share/pipewire/pipewire-pulse.conf" I was unable to find "content.exec" part, it could be the config file structure update or something, not sure.

I am referring to "by CharlesV » Tue Jan 02, 2024 5:13 pm" post here

including the point of the post/note above, your changes to survive the update, instead of edit the file "/usr/share/pipewire/pipewire-pulse.conf" - you just:

1. Create the folder "pipewire" (if does not exist) in "~/.config" folder of the current user:

Code: Select all

mkdir ~/.config/pipewire
2. copy "pipewire-pulse.conf" file from "/usr/share/pipewire" folder into "~/.config/pipewire" folder:

Code: Select all

sudo cp /usr/share/pipewire/pipewire-pulse.conf ~/.config/pipewire/
(you can copy all config files from there if you want)

3. Change ownership of the file:

Code: Select all

sudo chown USER:USER ~/.config/pipewire/pipewire-pulse.conf
(replace USER:USER with your actual username!)

4. Open the file in your favourite text editor:

Code: Select all

vim ~/.config/pipewire/pipewire-pulse.conf
5. Find the blocks

Code: Select all

context.exec =
and

Code: Select all

pulse.cmd =
(they are one on top of the other actually)

6. Add two lines of code to each block accordingly, to make like this:

Code: Select all

context.exec = [
    #{ path = "pactl"        args = "load-module module-always-sink" }
    #{ path = "pactl"        args = "upload-sample my-sample.wav my-sample" }
    #{ path = "/usr/bin/sh"  args = "~/.config/pipewire/default.pw" }
    { path = "pactl"         args = "load-module module-switch-on-connect" }
]
and

Code: Select all

pulse.cmd = [
    { cmd = "load-module" args = "module-always-sink" flags = [ ] }
    #{ cmd = "load-module" args = "module-switch-on-connect" }
    #{ cmd = "load-module" args = "module-gsettings" flags = [ nofail ] }
    { cmd = "load-module" args = "module-switch-on-connect" }
]
(Pay attention to those two last lines in each block)

7. Reboot and try, it works for me.

I posted different approach in my post (https://www.forum.mxlinux.org/viewtopic.php?t=73504), before I sorted the problem like this one.
you can check that post if you want, but I think this method is better way to solve it =)

Worth mentioning that if you want those changes system wide, if you have multiple users for example, then you can do these steps
into "/etc/pipewire" instead of "~/.config/pipewire"
(in that case ignore the step 3. as no ownership changes needed here).

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

Re: Request addition to pipewire config - auto switch

#20 Post by CharlesV »

@mxUs3r Nicely done! I shall have to give this a try on my next build (or before maybe!)
*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!

Post Reply

Return to “Bugs and Non-Package Requests Forum”