From 845f83c3e01377dc41824a57533dd934ba32252a Mon Sep 17 00:00:00 2001 From: thek4n Date: Tue, 24 Feb 2026 19:31:59 +0300 Subject: [PATCH] fix headphones charge in i3blocks --- home/user/.config/i3blocks/scripts/builder.sh | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/home/user/.config/i3blocks/scripts/builder.sh b/home/user/.config/i3blocks/scripts/builder.sh index 414f862..44692c2 100755 --- a/home/user/.config/i3blocks/scripts/builder.sh +++ b/home/user/.config/i3blocks/scripts/builder.sh @@ -80,15 +80,8 @@ cmd_pomodoro() { } cmd_bluetooth_battery() { - for uuid in $(timeout 1 bluetoothctl devices | cut -f2 -d' ' 2>/dev/null) - do - device_info="$(timeout 1 bluetoothctl info "${uuid}")" - - if echo "${device_info}" | grep -q 'Connected: yes\|Battery Percentage'; then - echo "${device_info}" | grep 'Battery Percentage' | awk -F '[()]' '{ print "🎧🔋"$2"%" }' - break - fi - done + device="$(upower -e | grep headset | head -1)" + upower -i "${device}" | grep percentage | awk '{ print "🎧🔋"$2"" }' } cmd_language() {