Polybar's bluetooth script hanging problem fixed

master
Meliurwen 3 years ago
parent 60e3bca73c
commit 05eaf66916
Signed by: meliurwen
GPG Key ID: 818A8B35E9F1CE10
  1. 15
      polybar/.config/polybar/scripts/bluetooth.sh

@ -3,17 +3,18 @@
case $1 in case $1 in
"") "")
if [ "$(bluetoothctl show | grep "Powered: yes" | wc -c)" -eq 0 ]; then bt_color=""
printf "%s\n" "%{F#66ffffff}" if bluetoothctl show | grep -q "Powered: no"; then
elif [ "$(printf "%s\n" info | bluetoothctl | grep 'Device' | wc -c)" -eq 0 ]; then bt_color="%{F#66ffffff}"
printf "%s\n" "" elif bluetoothctl info | grep -q "Device"; then
printf "%s\n" "%{F#2193ff}" bt_color="%{F#2193ff}"
else else
printf "%s\n" "%{F#2193ff}" :
fi fi
printf "%s%s\n" "$bt_color" ""
;; ;;
"--toggle") "--toggle")
if [ "$(bluetoothctl show | grep "Powered: yes" | wc -c)" -eq 0 ]; then if bluetoothctl show | grep -q "Powered: no"; then
bluetoothctl power on bluetoothctl power on
else else
bluetoothctl power off bluetoothctl power off

Loading…
Cancel
Save