respect aliases in trust menu

This commit is contained in:
Alexander Bocken 2021-08-24 21:30:53 +02:00
parent 3ca1cc0728
commit 74551c09a5
Signed by: Alexander
GPG Key ID: 1D237BE83F9B05E8

9
bt
View File

@ -207,7 +207,14 @@ case $choice in
"trust")
#search through all devices which are connected and only list those as options
# shellcheck disable=SC1091
untrusted_devices="$( awk '{print "bluetoothctl info "$2}' "$PAIRLIST" | . /dev/stdin | grep -E '(Alias:|Trusted:)' | sed -e 'N;s/\n/;/;s/^.?*Alias: //' | grep "Trusted: no" | awk -F ';' '{print $1}' )"
untrusted_device_ids="$( awk '{print "bluetoothctl info "$2}' "$PAIRLIST" | . /dev/stdin | grep -E '(Device |Trusted:)' | sed -e 'N;s/\n/;/;s/^.?*Alias: //' | grep "Trusted: no" | cut -d' ' -f2 )"
untrusted_devices="$( echo "$untrusted_device_ids" | while read -r id; do
if grep -q "$id" "$ALIASLIST"; then
grep "$id" "$ALIASLIST" | cut -d' ' --complement -f1
else
grep "$id" "$PAIRLIST" | cut -d' ' --complement -f1,2
fi
done)"
if [ "$( echo "$untrusted_devices" | wc -l )" -gt 0 ]
then
choice=$( echo "$untrusted_devices" | dmenu -l 10 -i -p 'trust which paired device?')