Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More convenient way to check connected devices #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions bluetooth.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/bin/sh
if [ $(bluetoothctl show | grep "Powered: yes" | wc -c) -eq 0 ]
then
#!/bin/bash

# Check if Bluetooth is powered on
if ! bluetoothctl show | grep -q "Powered: yes"; then
echo "%{F#66ffffff}"
else
if [ $(echo info | bluetoothctl | grep 'Device' | wc -c) -eq 0 ]
then
echo ""
# Check if any Bluetooth device is connected
if bluetoothctl info | grep -q 'Connected: yes'; then
DEVICE=$(bluetoothctl info | awk -F': ' '/Alias:/ { print $2 }')
echo "%{F#2193ff} $DEVICE "
else
echo ""
fi
echo "%{F#2193ff}"
fi

fi