Bluetooth headphones: Is it possible for audio output to switch automatically on connection?  [Solved]

Help for Current Versions of MX
When asking for help, use Quick System Info from MX Tools. It will be properly formatted using the following steps.
1. Click on Quick System Info in MX Tools
2. Right click in your post and paste.
Message
Author
davemx
Posts: 320
Joined: Sun Aug 12, 2018 2:31 pm

Bluetooth headphones: Is it possible for audio output to switch automatically on connection?

#1 Post by davemx »

I got a pair of Bluetooth headphones for Christmas, and having sorted out a couple of teething problems, they are working perfectly. My question is, is there a setting in XFCE for the sound system to automatically switch to Bluetooth output? I always have to do it manually. It's only a little thing, but am I missing something? I do know that this is possible in KDE.
Desktop: Mini-Box M350 with Asus H110i-plus motherboard, Pentium G4600 processor, 2TB SSD and 16Gb RAM DDR4-2133
Printer/Scanner: Brother MFC-J5335W
Laptop: Lenovo V15 ADA
Media Centre: Lenovo Q190

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

Re: Bluetooth headphones: Is it possible for audio output to switch automatically on connection?

#2 Post by CharlesV »

Please post your QSI ( MX Menu | Quick System Info | Copy for Forum | paste here )
*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!

davemx
Posts: 320
Joined: Sun Aug 12, 2018 2:31 pm

Re: Bluetooth headphones: Is it possible for audio output to switch automatically on connection?

#3 Post by davemx »

Here goes, though, as far as I can see, this is not a hardware problem as once I have changed the sound output manually, the headphones work perfectly:

Code: Select all

System:
  Kernel: 6.5.0-1mx-ahs-amd64 [6.5.3-1~mx23ahs] arch: x86_64 bits: 64 compiler: gcc v: 12.2.0
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.5.0-1mx-ahs-amd64 root=UUID=<filter> ro quiet splash
  Desktop: Xfce v: 4.18.1 tk: Gtk v: 3.24.36 info: xfce4-panel wm: xfwm v: 4.18.0 vt: 7
    dm: LightDM v: 1.26.0 Distro: MX-23.1_ahs_x64 Libretto October 15  2023 base: Debian GNU/Linux
    12 (bookworm)
Machine:
  Type: Desktop Mobo: ASUSTeK model: H110I-PLUS v: Rev X.0x serial: <superuser required>
    UEFI: American Megatrends v: 3805 date: 05/07/2018
CPU:
  Info: model: Intel Pentium G4600 bits: 64 type: MT MCP arch: Kaby Lake level: v2 built: 2018
    process: Intel 14nm family: 6 model-id: 0x9E (158) stepping: 9 microcode: 0xF4
  Topology: cpus: 1x cores: 2 tpc: 2 threads: 4 smt: enabled cache: L1: 128 KiB
    desc: d-2x32 KiB; i-2x32 KiB L2: 512 KiB desc: 2x256 KiB L3: 3 MiB desc: 1x3 MiB
  Speed (MHz): avg: 800 min/max: 800/3600 scaling: driver: intel_pstate governor: powersave
    cores: 1: 800 2: 800 3: 800 4: 800 bogomips: 28800
  Flags: ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3
  Vulnerabilities:
  Type: gather_data_sampling status: Not affected
  Type: itlb_multihit status: KVM: VMX unsupported
  Type: l1tf mitigation: PTE Inversion
  Type: mds mitigation: Clear CPU buffers; SMT vulnerable
  Type: meltdown mitigation: PTI
  Type: mmio_stale_data mitigation: Clear CPU buffers; SMT vulnerable
  Type: retbleed mitigation: IBRS
  Type: spec_rstack_overflow status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization
  Type: spectre_v2 mitigation: IBRS, IBPB: conditional, STIBP: conditional, RSB filling,
    PBRSB-eIBRS: Not affected
  Type: srbds mitigation: Microcode
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: Intel HD Graphics 630 vendor: ASUSTeK driver: i915 v: kernel arch: Gen-9.5
    process: Intel 14nm built: 2016-20 ports: active: HDMI-A-1 empty: DP-1,HDMI-A-2 bus-ID: 00:02.0
    chip-ID: 8086:5912 class-ID: 0300
  Display: x11 server: X.Org v: 1.21.1.7 compositor: xfwm v: 4.18.0 driver: X:
    loaded: modesetting unloaded: fbdev,vesa dri: iris gpu: i915 display-ID: :0.0 screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.00x11.22") s-diag: 582mm (22.93")
  Monitor-1: HDMI-A-1 mapped: HDMI-1 model: Asus VS247 serial: <filter> built: 2019
    res: 1920x1080 hz: 60 dpi: 94 gamma: 1.2 size: 521x293mm (20.51x11.54") diag: 598mm (23.5")
    ratio: 16:9 modes: max: 1920x1080 min: 720x400
  API: OpenGL v: 4.6 Mesa 23.1.2-1~mx23ahs renderer: Mesa Intel HD Graphics 630 (KBL GT2)
    direct-render: Yes
Audio:
  Device-1: Intel 100 Series/C230 Series Family HD Audio vendor: ASUSTeK driver: snd_hda_intel
    v: kernel bus-ID: 00:1f.3 chip-ID: 8086:a170 class-ID: 0403
  API: ALSA v: k6.5.0-1mx-ahs-amd64 status: kernel-api tools: alsamixer,amixer
  Server-1: PipeWire v: 1.0.0 status: active with: 1: pipewire-pulse status: active
    2: wireplumber status: active 3: pipewire-alsa type: plugin 4: pw-jack type: plugin
    tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: ASUSTeK PRIME B450M-A
    driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1 port: e000 bus-ID: 03:00.0
    chip-ID: 10ec:8168 class-ID: 0200
  IF: eth0 state: up speed: 1000 Mbps duplex: full mac: <filter>
  Device-2: Ralink RT5370 Wireless Adapter type: USB driver: rt2800usb bus-ID: 1-9:6
    chip-ID: 148f:5370 class-ID: 0000 serial: <filter>
  IF: wlan0 state: down mac: <filter>
Bluetooth:
  Device-1: TP-Link UB500 Adapter type: USB driver: btusb v: 0.8 bus-ID: 1-10:7 chip-ID: 2357:0604
    class-ID: e001 serial: <filter>
  Report: hciconfig ID: hci0 rfk-id: 0 state: up address: <filter> bt-v: 3.0 lmp-v: 5.1
    sub-v: d922 hci-v: 5.1 rev: dfc6
  Info: acl-mtu: 1021:6 sco-mtu: 255:12 link-policy: rswitch hold sniff park
    link-mode: peripheral accept service-classes: rendering, capturing, object transfer, audio,
    telephony
Drives:
  Local Storage: total: 1.82 TiB used: 786.14 GiB (42.2%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/sda maj-min: 8:0 vendor: SanDisk model: SDSSDH32000G size: 1.82 TiB block-size:
    physical: 512 B logical: 512 B speed: 6.0 Gb/s type: SSD serial: <filter> rev: 10RL scheme: GPT
Partition:
  ID-1: / raw-size: 25 GiB size: 24.44 GiB (97.76%) used: 10.13 GiB (41.4%) fs: ext4 dev: /dev/sda6
    maj-min: 8:6
  ID-2: /boot/efi raw-size: 100 MiB size: 98.4 MiB (98.42%) used: 25.2 MiB (25.6%) fs: vfat
    dev: /dev/sda1 maj-min: 8:1
  ID-3: /home raw-size: 1.42 TiB size: 1.4 TiB (98.36%) used: 652.03 GiB (45.6%) fs: ext4
    dev: /dev/sda12 maj-min: 8:12
Swap:
  Kernel: swappiness: 15 (default 60) cache-pressure: 100 (default)
  ID-1: swap-1 type: partition size: 16 GiB used: 0 KiB (0.0%) priority: -2 dev: /dev/sda5
    maj-min: 8:5
Sensors:
  System Temperatures: cpu: 31.0 C mobo: N/A
  Fan Speeds (RPM): fan-1: 1956 fan-2: 1021 fan-3: 0 fan-4: 0 fan-5: 0 fan-6: 0
Repos:
  Packages: pm: dpkg pkgs: 2312 libs: 1246 tools: apt,apt-get,aptitude,nala,synaptic pm: rpm
    pkgs: 0 pm: flatpak pkgs: 0
  No active apt repos in: /etc/apt/sources.list
  Active apt repos in: /etc/apt/sources.list.d/debian-stable-updates.list
    1: deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
  Active apt repos in: /etc/apt/sources.list.d/debian.list
    1: deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
    2: deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
  Active apt repos in: /etc/apt/sources.list.d/google-chrome.list
    1: deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main
  Active apt repos in: /etc/apt/sources.list.d/google-earth-pro.list
    1: deb [arch=amd64] http://dl.google.com/linux/earth/deb/ stable main
  Active apt repos in: /etc/apt/sources.list.d/mx.list
    1: deb http://mxlinux.mirrors.uk2.net/packages/mx/repo/ bookworm main non-free
    2: deb http://mxlinux.mirrors.uk2.net/packages/mx/repo/ bookworm ahs
  Active apt repos in: /etc/apt/sources.list.d/vivaldi.list
    1: deb [arch=amd64] https://repo.vivaldi.com/stable/deb/ stable main
Info:
  Processes: 309 Uptime: 4h 57m wakeups: 1 Memory: 15.49 GiB used: 5 GiB (32.3%) Init: SysVinit
  v: 3.06 runlevel: 5 default: graphical tool: systemctl Compilers: gcc: 12.2.0 alt: 12
  Client: shell wrapper v: 5.2.15-release inxi: 3.3.26
Boot Mode: UEFI
Desktop: Mini-Box M350 with Asus H110i-plus motherboard, Pentium G4600 processor, 2TB SSD and 16Gb RAM DDR4-2133
Printer/Scanner: Brother MFC-J5335W
Laptop: Lenovo V15 ADA
Media Centre: Lenovo Q190

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

Re: Bluetooth headphones: Is it possible for audio output to switch automatically on connection?

#4 Post by CharlesV »

There were some kernels that had weird issues and QSi is the fastest method to check multiple things at the same time. (ie we can now rule out the kernel )

There are three places to play with this: (mine swap over when bluetooth connects)

- MX Select sound - Make sure your default controller is specified. (Might have to select and apply twice. )

- In the Volume control, under Output devices - try making the Bluetooth to be the fallback (check mark)
__ You might also try making the on board speakers the fallback.

- On my volume control, in the Output Devices tab, I have six devices listed, but Bluetooth is ONLY listed when its connected and engaged. This is when I have to set my fallback. And then once the bluetooth device is disconnected, the speakers go to the default fallback.

One last thing - I have found that the liquorix kernels made a big difference with bluetooth (and sound handling too), on ALL of my machines. If nothing else works, I would load a liquirox kernel ( I am currently running the last 6.5 as well as the 6.6.8 and they both work well. )
*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!

davemx
Posts: 320
Joined: Sun Aug 12, 2018 2:31 pm

Re: Bluetooth headphones: Is it possible for audio output to switch automatically on connection?

#5 Post by davemx »

Nope. None of this worked. It took some effort to get the liquorix kernel onto my grub, too, as I use Grub Customizer to deal with the fact that I have 6 distros plus Windows on my hard drive. What I am asking for does work in MX-KDE, so I suspect it's a XFCE issue.

MX Select Sound: Even with Bluetooth sound enabled, I only get one choice here: PCH HDA Intel.
Volume Control: Fallback changes on its own to whatever is currently selected. As soon as I disconnect bluetooth, Line Out becomes the default and remains so when I reconnect bluetooth. Making the on-board speakers the fallback didn't work either.

Researching on the internet, all people asking about this issue seem to be XFCE users.

My thought on it would be that there needs to be an option to run a script when bluetooth 'phones are connected. Sadly, I could not write the script nor work out the trigger to run it with my present (lack of) knowledge.
Desktop: Mini-Box M350 with Asus H110i-plus motherboard, Pentium G4600 processor, 2TB SSD and 16Gb RAM DDR4-2133
Printer/Scanner: Brother MFC-J5335W
Laptop: Lenovo V15 ADA
Media Centre: Lenovo Q190

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

Re: Bluetooth headphones: Is it possible for audio output to switch automatically on connection?

#6 Post by CharlesV »

Hmm... well.. I am running indicator-sound-switcher, but I dont think that would do this. And I also have the following in my /etc/pulse/default.pa file:

Code: Select all

load-module module-switch-on-connect

There is also a pipewire equivalent, but I dont see that in my configs . In file /usr/share/pipewire/pipewire-pulse.conf , under content.exec:

Code: Select all

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

My notes on bluetooth show these two posts on 'auto switch bluetooth' .. I dont recall having to do this, but I was working heavily at my HP which speakers 'work' but no sound comes out - so I moved to AirPods and my Ontz. I did it initially for MX23 and then back on MX21 (where that machine is now. )

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

https://alexandra-zaharia.github.io/pos ... -in-linux/

I will run up my mx23 tester and double check that.
*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: 7076
Joined: Sun Jul 07, 2019 5:11 pm

Re: Bluetooth headphones: Is it possible for audio output to switch automatically on connection?  [Solved]

#7 Post by CharlesV »

oh.. yup .. I have BOTH of those mods in my MX23

Most likely it was this one that did it:

/usr/share/pipewire/pipewire-pulse.conf , under content.exec:

{ path = "pactl" args = "load-module module-switch-on-connect" }
And I have listed in my notes: "restart after changes"
*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!

davemx
Posts: 320
Joined: Sun Aug 12, 2018 2:31 pm

Re: Bluetooth headphones: Is it possible for audio output to switch automatically on connection?

#8 Post by davemx »

Thanks! Will have a look when I get on the computer later.
Desktop: Mini-Box M350 with Asus H110i-plus motherboard, Pentium G4600 processor, 2TB SSD and 16Gb RAM DDR4-2133
Printer/Scanner: Brother MFC-J5335W
Laptop: Lenovo V15 ADA
Media Centre: Lenovo Q190

davemx
Posts: 320
Joined: Sun Aug 12, 2018 2:31 pm

Re: Bluetooth headphones: Is it possible for audio output to switch automatically on connection?

#9 Post by davemx »

CharlesV wrote: Mon Jan 01, 2024 5:17 pm oh.. yup .. I have BOTH of those mods in my MX23

Most likely it was this one that did it:

/usr/share/pipewire/pipewire-pulse.conf , under content.exec:

{ path = "pactl" args = "load-module module-switch-on-connect" }
And I have listed in my notes: "restart after changes"
YES! This one did it. I amended the file as instructed then rebooted. It took a few seconds first time, but after that was fine. The trick is to avoid being too impatient clicking on the volume icon, until it's had its chance to do its thing! You know when it's ready, because the volume slider notification pops up on screen.

One suggestion: Maybe this line could be included in pipewire-pulse.conf as standard. Or if that is not advisable can be added/removed in MX Tweak.
Last edited by davemx on Tue Jan 02, 2024 10:47 am, edited 1 time in total.
Desktop: Mini-Box M350 with Asus H110i-plus motherboard, Pentium G4600 processor, 2TB SSD and 16Gb RAM DDR4-2133
Printer/Scanner: Brother MFC-J5335W
Laptop: Lenovo V15 ADA
Media Centre: Lenovo Q190

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

Re: Bluetooth headphones: Is it possible for audio output to switch automatically on connection?

#10 Post by CharlesV »

davemx wrote: Tue Jan 02, 2024 9:35 am
CharlesV wrote: Mon Jan 01, 2024 5:17 pm oh.. yup .. I have BOTH of those mods in my MX23

Most likely it was this one that did it:

/usr/share/pipewire/pipewire-pulse.conf , under content.exec:

{ path = "pactl" args = "load-module module-switch-on-connect" }
And I have listed in my notes: "restart after changes"
YES! This one did it. I amended the file as instructed then rebooted. It took a few seconds first time, but after that was fine. The trick is to avoid being too impatient clicking on the volume icon, until it's had its chance to do its thing! You know when it's ready, because the volume slider notification pops up on screen.

One suggestion: Maybe this line could be included in pipewire-pulse.conf as standard. Or if that is not advisable can be added/removed in MX Tweak.
Excellent! Glad its working! And good thought on that, I will add it to the suggestions topic
*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 “MX Help”