[PB] Fix bluetooth module and show alias when connected

This commit is contained in:
Yash Karandikar 2023-09-26 10:55:04 -05:00
parent c24771a505
commit c09bdab9b8

View file

@ -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