yeet
This commit is contained in:
@@ -21,7 +21,10 @@ if [ "$BLUETOOTH_POWERED" != "yes" ]; then
|
||||
fi
|
||||
|
||||
# Get connected devices
|
||||
CONNECTED_DEVICES=$(bluetoothctl devices Connected | grep "^Device" | awk '{for(i=3;i<=NF;i++) printf "%s ", $i; print ""}' | sed 's/ $//')
|
||||
# Note: bluetoothctl devices Connected doesn't work as a direct command argument
|
||||
# It must be piped through bluetoothctl's interactive shell
|
||||
# Also need to strip ANSI escape codes from output
|
||||
CONNECTED_DEVICES=$(echo "devices Connected" | bluetoothctl 2>/dev/null | sed 's/\x1b\[[0-9;]*m//g' | grep "Device " | awk '{for(i=3;i<=NF;i++) printf "%s ", $i; print ""}' | sed 's/ $//')
|
||||
|
||||
if [ -z "$CONNECTED_DEVICES" ]; then
|
||||
echo "$BT_ICON No devices"
|
||||
@@ -39,7 +42,7 @@ fi
|
||||
# Handle click events (for i3status-rust custom block)
|
||||
if [ "${BLOCK_BUTTON:-}" = "1" ]; then
|
||||
# Left click - show all connected devices with details
|
||||
DETAILED_DEVICES=$(bluetoothctl devices Connected | while read -r line; do
|
||||
DETAILED_DEVICES=$(echo "devices Connected" | bluetoothctl 2>/dev/null | sed 's/\x1b\[[0-9;]*m//g' | grep "Device " | while read -r line; do
|
||||
MAC=$(echo "$line" | awk '{print $2}')
|
||||
NAME=$(echo "$line" | awk '{for(i=3;i<=NF;i++) printf "%s ", $i; print ""}' | sed 's/ $//')
|
||||
echo "• $NAME ($MAC)"
|
||||
|
||||
Reference in New Issue
Block a user