Files
crylia-theme/polybar/scripts/bluetooth.sh
2021-10-04 23:17:58 +02:00

23 lines
370 B
Bash
Executable File

#!/bin/bash
STATE=$(bluetoothctl show | grep Powered)
DEVICE_NAME=$(bluetoothctl info | grep Name: | awk '{ first = $1; $1 = ""; print $0 }')
POWERED=""
COLOR=""
STRING=""
if [[ $STATE == *'yes'* ]]
then
POWERED=" ON"
COLOR=""
else
POWERED=" OFF"
COLOR=""
fi
if [[ $DEVICE_NAME ]]
then
POWERED=" "
fi
echo $POWERED$CONNECTED$DEVICE_NAME