From c09bdab9b809b0de1da04986ab099b8b0866622a Mon Sep 17 00:00:00 2001 From: Yash Karandikar Date: Tue, 26 Sep 2023 10:55:04 -0500 Subject: [PATCH] [PB] Fix bluetooth module and show alias when connected --- .config/polybar/bluetooth.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.config/polybar/bluetooth.sh b/.config/polybar/bluetooth.sh index 5df0214..734c5f4 100755 --- a/.config/polybar/bluetooth.sh +++ b/.config/polybar/bluetooth.sh @@ -3,13 +3,12 @@ if [ $(bluetoothctl show | grep "Powered: yes" | wc -c) -eq 0 ] then echo -e "%{F#66ffffff}\uf293" -else - if [ $(echo info | bluetoothctl | grep 'Device' | wc -c) -eq 0 ] - then - echo -e "\uf293" -else +elif [ $(echo info | bluetoothctl | grep 'DeviceSet' | wc -c) -eq 0 ] + then BAT=$(bluetoothctl info | grep Percentage | cut -d":" -f 2 | cut -d"(" -f 2 | sed 's/)/%/' | sed 's/^/ /') - echo -e "%{F#81a1c1}\uf293%{F#ffffff}$BAT" - fi + ALIAS=$(bluetoothctl info | grep Alias | cut -d":" -f 2 | xargs echo -n) + echo -e "%{F#81a1c1}\uf293%{F#ffffff}$BAT ($ALIAS)" +else + echo -e "\uf293" fi