From 4ed78ac6a0fed52797cb46df339793a2461dbcc5 Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Sat, 3 Jul 2021 11:37:24 +0200 Subject: [PATCH] =?UTF-8?q?correct=20display=20of=20=F0=9F=94=97=20if=20no?= =?UTF-8?q?=20devices=20connected?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bt b/bt index ff0c007..5f17959 100755 --- a/bt +++ b/bt @@ -65,6 +65,8 @@ startup & update_pair_list & connected_ids="$(bluetoothctl devices | awk '{print "bluetoothctl info "$2}' | . /dev/stdin | grep -E '(^Device |Connected:)' | sed -e 'N;s/\n/;/' | grep 'Connected: yes' | cut -d' ' -f2,5)" + +[ -z "$connected_ids" ] || connected_devices="$(echo "$connected_ids" | while read -r id; do if grep -q "$id" "$ALIASLIST"; then grep "$id" "$ALIASLIST" | cut -d' ' --complement -f1 @@ -99,7 +101,9 @@ disp_devices="$( echo "$paired_devices" | grep -vf "$BLACKLIST" )" #show which devices are connected in menu disp_devices_with_links="$(echo "$paired_devices" | while read -r device; do printf '%s' "$device" - if echo "$device" | grep -q "$connected_devices"; then + if [ -n "$connected_devices" ] && + echo "$device" | grep -q "$connected_devices" + then printf '🔗' fi printf '\n' @@ -258,7 +262,7 @@ case $choice in notify-send "bt" "device not in paired-devices list, re-adding (device needs to be in pairing mode for this)" scan on echo "Scan on" - sleep $SCAN_PERIOD + sleep "$SCAN_PERIOD" echo Attempting to pair... bluetoothctl pair "$dev_id" scan off