Page 1 of 1

MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Sun Sep 29, 2024 5:57 pm
by madmax25
In the lower right corner of my screen, I can see the battery level of my laptop, but if I connect my BT headphones I don't know the according battery level until they stop working.

Is there any way to add that information right to where the ordinary battery level is being displayed or perhaps even add it to Conky, please?

Re: MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Sun Sep 29, 2024 7:57 pm
by Stevo
Apparently we need to edit the configuration file /etc/bluetooth/main.conf and change the line

Code: Select all

# Experimental = false
to

Code: Select all

Experimental = true
save the file.

I'm running systemd with MX KDE, so I restarted bluetooth with

Code: Select all

systemctl restart bluetooth
(try rebooting if this does not work), reconnected my device, and now its charge level shows in the little Bluetooth taskbar widget when I hover over it.

Let me know if this works on XFCE! You can see it also in the terminal now with the command:

Code: Select all

bluetoothctl info
Mine has the battery % on the last line:

Code: Select all

Device 41:42:05:8A:82:B3 (public)
        Name: F6
        Alias: F6
        Class: 0x00240404
        Icon: audio-headset
        Paired: yes
        Bonded: yes
        Trusted: yes
        Blocked: no
        Connected: yes
        LegacyPairing: no
        UUID: Serial Port               (00001101-0000-1000-8000-00805f9b34fb)
        UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
        UUID: Advanced Audio Distribu.. (0000110d-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
        UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
        Battery Percentage: 0x28 (40)
So Conky should be able to use that value with the right magic code to scrape the value.
st

Re: MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Sun Sep 29, 2024 8:30 pm
by madmax25
Sorry, it doesn't seem to work.
I already tried that guide, which led me to my question here.

In the bluetoothctl info, I didn't find any line referring to the wanted battery percentage value,
but I will try it once more, to be sure I didn't miss anything on my first attempt (now, after your post, I actually know what to look for).

I will report back afterwards, asap ...

Re: MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Sun Sep 29, 2024 8:40 pm
by Stevo
I have heard that some headphones use a nonstandard method to communicate, but I'm using some cheapo BT earbuds. I also have some other cheapos, like several sets of headbands/sleep masks with headphones built in, that one can pick up for a few bucks on AliExpress...yeah, this one works too:

Code: Select all

Device 41:42:53:0E:DE:4F (public)
        Name: BT-Music
        Alias: BT-Music
        Class: 0x00240404
        Icon: audio-headset
        Paired: yes
        Bonded: yes
        Trusted: yes
        Blocked: no
        Connected: yes
        LegacyPairing: no
        UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
        UUID: Advanced Audio Distribu.. (0000110d-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
        UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
        Battery Percentage: 0x64 (100)

Re: MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Sun Sep 29, 2024 10:52 pm
by dolphin_oracle
edit* worked OK after a reboot/reconnect

Code: Select all


┌─[dolphin@mx23kde]─[10:53:47 pm]────────────────────────────────────────────────────────────────────────────────[/]
└─> bluetoothctl info
Device AC:12:2F:DB:15:EC (public)
        Name: Soundcore Life Q30
        Alias: Soundcore Life Q30
        Class: 0x00240404
        Icon: audio-headset
        Paired: yes
        Bonded: yes
        Trusted: yes
        Blocked: no
        Connected: yes
        LegacyPairing: no
        UUID: Serial Port               (00001101-0000-1000-8000-00805f9b34fb)
        UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
        UUID: Advanced Audio Distribu.. (0000110d-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
        UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
        UUID: Vendor specific           (66666666-6666-6666-6666-666666666666)
        Battery Percentage: 0x5a (90)

**edit***

ah, the usually battery monitor in KDE picks it up right off, if you left click to bring out the expanded battery info. Haven't tried Xfce yet, but even if it doesn't, you could probably make a genmon plugin with a custom bluetoothctl info command work to display a percentage.

Re: MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Sun Sep 29, 2024 10:59 pm
by Stevo
dolphin_oracle wrote: Sun Sep 29, 2024 10:52 pm edit* worked OK after a reboot/reconnect


CLI stuff

[/code]
Does it show up on the xfce taskbar BT widget like the Plasma one if you hover the cursor over it?

Re: MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Sun Sep 29, 2024 11:04 pm
by dolphin_oracle
it shows in the Xfce power manager when you left click to get the expanded battery info, just like in KDE.

so easy peasy really.

Re: MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Sun Sep 29, 2024 11:10 pm
by timkb4cq
Not hovering on the panel widget. If you open Bluetooth Devices and hover over the symbols to the right of a connected device it does show up.
I'm not convinced it's always a real reading since it doesn't seem to change. It was 90 just after removing from the charger, and is still at 90 after listening for half an hour. Of course this is an $8 set of headphones from Ollie's Outlet.

Re: MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Sun Sep 29, 2024 11:37 pm
by dolphin_oracle
Image

view from the Xfce4 power manager panel plugin

Re: MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Mon Sep 30, 2024 1:54 am
by m_pav
Works perfectly on Xfce, no restart needed, just stopped and restarted BT service. This is with my lower mid range Sennheiser HD540 BT Headset (all I could afford) which I use to fix up bad voice recordings.

Blueman Battery icon now shows when connected
Image

Right click and select info in blueman does not show battery info.
Image

Xfce Tray Power Icon shows it
Image

Re: MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Mon Sep 30, 2024 9:19 am
by Stevo
Since Ubuntu has had it as default for years, here's my vote for following suit.

If not that, then added to MX Tweak.

Re: MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Mon Sep 30, 2024 10:00 am
by dolphin_oracle
Stevo wrote: Mon Sep 30, 2024 9:19 am Since Ubuntu has had it as default for years, here's my vote for following suit.

If not that, then added to MX Tweak.
I personally don't mind it being a default, but we would probably need to package up the package that hosts the file.

a tweak should be easy enough though.

Re: MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Mon Sep 30, 2024 10:21 pm
by TauTsar
Worked for me too! Thanks for this!

Code: Select all

Snapshot created on: 20240901_1744
System:
  Kernel: 6.10.11-2-liquorix-amd64 [6.10-15~mx23ahs] arch: x86_64 bits: 64 compiler: gcc v: 12.2.0 parameters: audit=0
    intel_pstate=disable BOOT_IMAGE=/vmlinuz-6.10.11-2-liquorix-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.4_ahs_x64 Libretto May 19  2024 base: Debian GNU/Linux 12
    (bookworm)
Machine:
  Type: Desktop System: ASRock product: B650E Taichi Lite v: N/A serial: <superuser required>
  Mobo: ASRock model: B650E Taichi Lite serial: <superuser required> UEFI: American Megatrends
    LLC. v: 3.05 date: 07/11/2024
Battery:
  Device-1: hidpp_battery_0 model: Logitech Wireless Keyboard serial: <filter>
    charge: 55% (should be ignored) rechargeable: yes status: discharging
CPU:
  Info: model: AMD Ryzen 7 7800X3D bits: 64 type: MT MCP arch: Zen 4 gen: 5 level: v4 note: check
    built: 2022+ process: TSMC n5 (5nm) family: 0x19 (25) model-id: 0x61 (97) stepping: 2
    microcode: 0xA601206
  Topology: cpus: 1x cores: 8 tpc: 2 threads: 16 smt: enabled cache: L1: 512 KiB
    desc: d-8x32 KiB; i-8x32 KiB L2: 8 MiB desc: 8x1024 KiB L3: 96 MiB desc: 1x96 MiB
  Speed (MHz): avg: 1875 high: 4844 min/max: 545/5050 scaling: driver: amd-pstate-epp
    governor: performance cores: 1: 4840 2: 545 3: 4842 4: 4844 5: 4722 6: 4771 7: 545 8: 545 9: 545
    10: 545 11: 545 12: 545 13: 545 14: 545 15: 545 16: 545 bogomips: 134396
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
  Vulnerabilities:
  Type: gather_data_sampling status: Not affected
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data status: Not affected
  Type: reg_file_data_sampling status: Not affected
  Type: retbleed status: Not affected
  Type: spec_rstack_overflow mitigation: Safe RET
  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: Enhanced / Automatic IBRS; IBPB: conditional; STIBP: always-on;
    RSB filling; PBRSB-eIBRS: Not affected; BHI: Not affected
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: AMD Navi 31 [Radeon RX 7900 XT/7900 XTX] vendor: ASRock driver: amdgpu v: kernel
    arch: RDNA-3 code: Navi-3x process: TSMC n5 (5nm) built: 2022+ pcie: gen: 4 speed: 16 GT/s
    lanes: 16 ports: active: HDMI-A-1 empty: DP-1, DP-2, DP-3, Writeback-1 bus-ID: 03:00.0
    chip-ID: 1002:744c class-ID: 0300
  Device-2: AMD Raphael vendor: ASRock driver: amdgpu v: kernel arch: RDNA-2 code: Navi-2x
    process: TSMC n7 (7nm) built: 2020-22 pcie: gen: 4 speed: 16 GT/s lanes: 16 ports: active: none
    empty: DP-4, DP-5, DP-6, HDMI-A-2, Writeback-2 bus-ID: 4f:00.0 chip-ID: 1002:164e
    class-ID: 0300 temp: 36.0 C
  Display: x11 server: X.Org v: 1.21.1.7 with: Xwayland v: 22.1.9 compositor: xfwm v: 4.18.0
    driver: X: loaded: amdgpu unloaded: fbdev dri: radeonsi gpu: amdgpu display-ID: :0.0 screens: 1
  Screen-1: 0 s-res: 3840x2160 s-dpi: 96 s-size: 1016x571mm (40.00x22.48")
    s-diag: 1165mm (45.88")
  Monitor-1: HDMI-A-1 mapped: HDMI-A-0 model: LG (GoldStar) TV SSCR2 serial: <filter> built: 2021
    res: 3840x2160 dpi: 61 gamma: 1.2 size: 1600x900mm (62.99x35.43") diag: 1836mm (72.3")
    ratio: 16:9 modes: max: 3840x2160 min: 720x400
  API: OpenGL v: 4.6 Mesa 23.1.2-1~mx23ahs renderer: AMD Radeon Graphics (gfx1100 LLVM 15.0.6
    DRM 3.57 6.10.11-2-liquorix-amd64) direct-render: Yes
Audio:
  Device-1: AMD driver: snd_hda_intel v: kernel pcie: bus-ID: 3-8:4 chip-ID: 26ce:0a06 gen: 4
    class-ID: 0300 speed: 16 GT/s lanes: 16 bus-ID: 03:00.1 chip-ID: 1002:ab30 class-ID: 0403
  Device-2: AMD Rembrandt Radeon High Definition Audio driver: snd_hda_intel v: kernel pcie:
    gen: 4 speed: 16 GT/s lanes: 16 bus-ID: 4f:00.1 chip-ID: 1002:1640 class-ID: 0403
  Device-3: AMD Family 17h/19h HD Audio driver: N/A alternate: snd_hda_intel pcie: gen: 4
    speed: 16 GT/s lanes: 16 bus-ID: 4f:00.6 chip-ID: 1022:15e3 class-ID: 0403
  Device-4: Generic USB Audio type: USB driver: hid-generic,snd-usb-audio,usbhid
  API: ALSA v: k6.10.11-2-liquorix-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: Intel Wi-Fi 6 AX210/AX211/AX411 160MHz vendor: Rivet Networks driver: iwlwifi v: kernel
    modules: wl pcie: gen: 2 speed: 5 GT/s lanes: 1 bus-ID: 49:00.0 chip-ID: 8086:2725 class-ID: 0280
  IF: wlan0 state: down mac: <filter>
  Device-2: Realtek Killer E3000 2.5GbE vendor: ASRock driver: r8169 v: kernel pcie: gen: 2
    speed: 5 GT/s lanes: 1 port: a000 bus-ID: 4a:00.0 chip-ID: 10ec:3000 class-ID: 0200
  IF: eth0 state: down mac: <filter>
  IF-ID-1: usb0 state: unknown speed: -1 duplex: half mac: <filter>
Bluetooth:
  Device-1: Intel AX210 Bluetooth type: USB driver: btusb v: 0.8 bus-ID: 3-7:3 chip-ID: 8087:0032
    class-ID: e001
  Report: hciconfig ID: hci0 rfk-id: 1 state: up address: <filter>
  Info: acl-mtu: 1021:4 sco-mtu: 96:6 link-policy: rswitch sniff link-mode: peripheral accept
    service-classes: rendering, capturing, object transfer, audio, telephony
  Device-2: Google Nexus/Pixel Device (tether+ debug) type: USB driver: rndis_host v: kernel
    bus-ID: 6-1.4:3 chip-ID: 18d1:4ee4 class-ID: 0a00 serial: <filter>
Drives:
  Local Storage: total: 1.86 TiB used: 106.66 GiB (5.6%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Lexar model: SSD NM790 2TB size: 1.86 TiB block-size:
    physical: 512 B logical: 512 B speed: 63.2 Gb/s lanes: 4 type: SSD serial: <filter> rev: 11296
    temp: 45.9 C scheme: GPT
Partition:
  ID-1: / raw-size: 942.4 GiB size: 926.54 GiB (98.32%) used: 106.12 GiB (11.5%) fs: ext4
    dev: /dev/nvme0n1p6 maj-min: 259:6
  ID-2: /boot raw-size: 1.94 GiB size: 1.94 GiB (99.80%) used: 552.9 MiB (27.9%) fs: vfat
    dev: /dev/nvme0n1p5 maj-min: 259:5
Swap:
  Kernel: swappiness: 15 (default 60) cache-pressure: 100 (default)
  ID-1: swap-1 type: partition size: 9.52 GiB used: 0 KiB (0.0%) priority: -2 dev: /dev/nvme0n1p7
    maj-min: 259:7
  ID-2: swap-2 type: file size: 6 GiB used: 0 KiB (0.0%) priority: -3 file: /swap/swap
Sensors:
  System Temperatures: cpu: 45.8 C mobo: N/A
  Fan Speeds (RPM): N/A
  GPU: device: amdgpu temp: 37.0 C device: amdgpu temp: 35.0 C mem: 40.0 C fan: 0 watts: 19.00
Repos:
  Packages: 2767 pm: dpkg pkgs: 2758 libs: 1480 tools: apt,apt-get,aptitude,nala,synaptic pm: rpm
    pkgs: 0 pm: flatpak pkgs: 9
  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
    3: deb http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware
  Active apt repos in: /etc/apt/sources.list.d/mx.list
    1: deb http://mirrors.rit.edu/mxlinux/mx-packages/mx/repo/ bookworm main non-free
    2: deb http://mirrors.rit.edu/mxlinux/mx-packages/mx/testrepo/ bookworm test
    3: deb http://mirrors.rit.edu/mxlinux/mx-packages/mx/repo/ bookworm ahs
Info:
  Processes: 458 Uptime: 10m wakeups: 5 Memory: 30.44 GiB used: 2.3 GiB (7.5%) 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
Stevo wrote: Sun Sep 29, 2024 7:57 pm Apparently we need to edit the configuration file /etc/bluetooth/main.conf and change the line

Code: Select all

# Experimental = false
to

Code: Select all

Experimental = true
save the file.

I'm running systemd with MX KDE, so I restarted bluetooth with

Code: Select all

systemctl restart bluetooth
(try rebooting if this does not work), reconnected my device, and now its charge level shows in the little Bluetooth taskbar widget when I hover over it.

Let me know if this works on XFCE! You can see it also in the terminal now with the command:

Code: Select all

bluetoothctl info
Mine has the battery % on the last line:

Code: Select all

Device 41:42:05:8A:82:B3 (public)
        Name: F6
        Alias: F6
        Class: 0x00240404
        Icon: audio-headset
        Paired: yes
        Bonded: yes
        Trusted: yes
        Blocked: no
        Connected: yes
        LegacyPairing: no
        UUID: Serial Port               (00001101-0000-1000-8000-00805f9b34fb)
        UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
        UUID: Advanced Audio Distribu.. (0000110d-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
        UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
        Battery Percentage: 0x28 (40)
So Conky should be able to use that value with the right magic code to scrape the value.
st

Re: MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Sat Oct 05, 2024 1:56 pm
by dolphin_oracle
how does this language look for a mx-tweak option to enable battery info being exposed for bluetooth devices? @Stevo and others...


Image

note, I am recommending a system restart as I've found that just restarting bluetooth daemon really plays havoc with KDE's bluetooth management, especially if a bluetooth device is actually connected.

Re: MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Sat Oct 05, 2024 2:54 pm
by Jerry3904
Text makes sense to me

Re: MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Sat Oct 05, 2024 2:56 pm
by Eadwine Rose
Clear as water to me.

Re: MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Sat Oct 05, 2024 4:23 pm
by Stevo
It also seems fine to me.

Re: MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Sat Oct 05, 2024 4:25 pm
by dolphin_oracle
those comments are good enough for me. sending strings to transifex.

Re: MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Sun Oct 06, 2024 11:59 pm
by LinuxSpring1
dolphin_oracle wrote: Sat Oct 05, 2024 1:56 pm how does this language look for a mx-tweak option to enable battery info being exposed for bluetooth devices? @Stevo and others...


Image

note, I am recommending a system restart as I've found that just restarting bluetooth daemon really plays havoc with KDE's bluetooth management, especially if a bluetooth device is actually connected.
Language looks fine to me.

But will this work only with XFCe? And not with KDE?

Re: MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Mon Oct 07, 2024 12:31 am
by Stevo
It's been working well for me in the KDE taskbar widget, both in the cursor hover popup, and when it's clicked.

Re: MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Mon Oct 07, 2024 6:33 am
by dolphin_oracle
LinuxSpring1 wrote: Sun Oct 06, 2024 11:59 pm
dolphin_oracle wrote: Sat Oct 05, 2024 1:56 pm how does this language look for a mx-tweak option to enable battery info being exposed for bluetooth devices? @Stevo and others...


Image

note, I am recommending a system restart as I've found that just restarting bluetooth daemon really plays havoc with KDE's bluetooth management, especially if a bluetooth device is actually connected.
Language looks fine to me.

But will this work only with XFCe? And not with KDE?
Screenshot is actually kde.

It will work on anything. Even if some battery monitor doesn’t pick it up the battery info is available via command line.

Re: MX 23.4 xfce - battery lavel indicator for Bt headphones wanted

Posted: Mon Oct 07, 2024 7:36 am
by /df
In the draft text, `bluetooth` should be `Bluetooth`. Whether `Adapters` in the existing text should be `adapters` is another issue.