scripts/i3-configuration/i3blocks/bluetooth.sh

16 lines
381 B
Bash
Executable File

#!/bin/bash
# Get Bluetooth device info
bluetooth_info=$(bluetoothctl info)
# Check if Bluetooth is connected
if echo "$bluetooth_info" | grep -q "Connected: yes"; then
device=$(echo "$bluetooth_info" | grep "Alias" | cut -d ' ' -f2-)
echo "$device" #  is the Bluetooth icon
echo
echo "#50FA7B" # Green for connected
else
echo " Disconnected"
fi