From dfac83a06408ca3564f2ea4c2a1b3fb2f6d75904 Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Sat, 25 Jul 2020 21:43:10 +0200 Subject: [PATCH] Increase boot up time if many devices are present This will lead to less accurate behaviour with many devices listed in bluetoothctl devices but otherwise the script becomes unbearably slow. Remove head from the start up process if you wish to disable this feature --- bt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bt b/bt index bd7343f..f6227b0 100755 --- a/bt +++ b/bt @@ -1,7 +1,8 @@ #!/bin/sh SCAN_PERIOD=5 AUTOTRUST=false #trust every newly paired device -AUTOSCAN=true #immediately start scanning when started to speed up pairing process +AUTOSCAN=false #immediately start scanning when started to speed up pairing process + #locations of blacklist and hard coded list of paired devices (watch out, need to modify Makefile as well if you want to change these values and still use make install) BLACKLIST=${XDG_DATA_HOME:-$HOME/.local/share}/bt/blacklist PAIRLIST=${XDG_DATA_HOME:-$HOME/.local/share}/bt/paired @@ -75,8 +76,9 @@ startup(){ startup & update_pair_list & +# include head command here to speed up launch if too many devices are listed (long uptime and long scanning will lead to this depending on your surroundings) # shellcheck disable=SC1091 -if bluetoothctl devices | awk '{print "bluetoothctl info "$2}' | . /dev/stdin | grep -q "Connected: yes" +if bluetoothctl devices | head | awk '{print "bluetoothctl info "$2}' | . /dev/stdin | grep -q "Connected: yes" then actions="$(printf "disconnect\n%s" "$actions")" fi