polybar-bluetooth icon indicating copy to clipboard operation
polybar-bluetooth copied to clipboard

Show BT device name

Open wdog opened this issue 3 years ago • 0 comments

this is a little improvement to be improved of bluetooth.sh

#!/bin/bash

# not connected
if [ $(bluetoothctl show | grep "Powered: yes" | wc -c) -eq 0 ]
then
 echo "%{F#ffffff}"
else
 # connected, but no device
 if [ $(echo info | bluetoothctl | grep 'Device' | wc -c) -eq 0 ]
 then
   echo ""
 else
   # get device alias
   DEVICE=`echo info | bluetoothctl | grep 'Alias:' | awk -F:  '{ print $2 }'`
   if [[ -z "${DEVICE// }" ]];
   then
     echo "%{F#2193ff} "
   else
     echo "%{F#2193ff} $DEVICE "
   fi
 fi
fi

wdog avatar Apr 17 '22 16:04 wdog