fixed pairing issue
This commit is contained in:
parent
dfa24a8967
commit
11689c2e22
11
bt
11
bt
@ -2,7 +2,7 @@
|
|||||||
SCAN_PERIOD=5
|
SCAN_PERIOD=5
|
||||||
AUTOTRUST=false #trust every newly paired device
|
AUTOTRUST=false #trust every newly paired device
|
||||||
AUTOSCAN=false #immediately start scanning when started to speed up pairing process
|
AUTOSCAN=false #immediately start scanning when started to speed up pairing process
|
||||||
#If you want to update symbols in your status bar add your details below:
|
#If you want to update symbols in your statusbar add your details below:
|
||||||
bar="dwmblocks"
|
bar="dwmblocks"
|
||||||
barsignal="4"
|
barsignal="4"
|
||||||
|
|
||||||
@ -10,11 +10,9 @@ barsignal="4"
|
|||||||
BLACKLIST=${XDG_DATA_HOME:-$HOME/.local/share}/bt/blacklist
|
BLACKLIST=${XDG_DATA_HOME:-$HOME/.local/share}/bt/blacklist
|
||||||
PAIRLIST=${XDG_DATA_HOME:-$HOME/.local/share}/bt/paired
|
PAIRLIST=${XDG_DATA_HOME:-$HOME/.local/share}/bt/paired
|
||||||
|
|
||||||
actions="pair
|
actions="$(printf 'pair\nunpair\n')"
|
||||||
unpair"
|
|
||||||
|
|
||||||
[ "$AUTOTRUST" = false ] && actions="${actions}
|
[ "$AUTOTRUST" = false ] && actions="$(printf '%s\ntrust\n' "$actions")"
|
||||||
trust"
|
|
||||||
|
|
||||||
#Checks for necessary programs to be present. Very unlikely not to be present but let's just err on the safer side.
|
#Checks for necessary programs to be present. Very unlikely not to be present but let's just err on the safer side.
|
||||||
for prog in dmenu bluetoothctl awk cat date nl; do
|
for prog in dmenu bluetoothctl awk cat date nl; do
|
||||||
@ -103,6 +101,7 @@ bt_IDS="$( ( bluetoothctl paired-devices && cat "$PAIRLIST" ) | sort -u | awk '{
|
|||||||
|
|
||||||
#Compile list of all device Names of paired devices (from bluetoothctl and from hardcoded list)
|
#Compile list of all device Names of paired devices (from bluetoothctl and from hardcoded list)
|
||||||
paired_devices="$( ( bluetoothctl paired-devices && cat "$PAIRLIST" ) | sort -u | awk '{for (i=3; i<NF; i++) printf $i " "; print $NF}' )"
|
paired_devices="$( ( bluetoothctl paired-devices && cat "$PAIRLIST" ) | sort -u | awk '{for (i=3; i<NF; i++) printf $i " "; print $NF}' )"
|
||||||
|
echo "paired_devices:$paired_devices"
|
||||||
|
|
||||||
disp_devices="$( echo "$paired_devices" | grep -vf "$BLACKLIST" )"
|
disp_devices="$( echo "$paired_devices" | grep -vf "$BLACKLIST" )"
|
||||||
|
|
||||||
@ -159,7 +158,7 @@ pair(){
|
|||||||
bluetoothctl trust "$dev_id"
|
bluetoothctl trust "$dev_id"
|
||||||
fi
|
fi
|
||||||
#if device is not already hard coded as paired, add to paired devices list
|
#if device is not already hard coded as paired, add to paired devices list
|
||||||
if $pair_succesful && [ "$( grep "$dev_id" "$PAIRLIST")" = "" ] || [ "$(wc -l "$PAIRLIST")" -eq 0 ]
|
if $pair_succesful && [ "$( grep "$dev_id" "$PAIRLIST")" = "" ] || [ "$(wc -l < "$PAIRLIST")" -eq 0 ]
|
||||||
then
|
then
|
||||||
echo to be added to "$PAIRLIST":
|
echo to be added to "$PAIRLIST":
|
||||||
echo Device "$dev_id" "$choice"
|
echo Device "$dev_id" "$choice"
|
||||||
|
Loading…
Reference in New Issue
Block a user