diff --git a/Makefile b/Makefile index 6af81a1..dbe0e85 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ install: chmod 755 $(DESTDIR)/bt touch $(DATA_DIR)/blacklist touch $(DATA_DIR)/paired + touch $(DATA_DIR)/alias uninstall: rm -f $(DESTDIR)/bt @@ -27,5 +28,6 @@ clear: mkdir -p $(DATA_DIR) touch $(DATA_DIR)/paired touch $(DATA_DIR)/blacklist + touch $(DATA_DIR)/alias .PHONY: install uninstall clear diff --git a/bt b/bt index 01c3a2a..5f45ed9 100755 --- a/bt +++ b/bt @@ -9,6 +9,7 @@ barsignal="4" #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 +ALIASLIST=${XDG_DATA_HOME:-$HOME/.local/share}/bt/alias actions="$(printf 'pair\nunpair\n')" @@ -79,10 +80,12 @@ startup(){ if [ "$1" = "edit" ]; then case $2 in - "pairlist")${EDITOR:-vim} "$PAIRLIST" && exit;; - "blacklist")${EDITOR:-vim} "$BLACKLIST" && exit;; + "pairlist")${EDITOR:-vim} "$PAIRLIST";; + "blacklist")${EDITOR:-vim} "$BLACKLIST";; + "aliaslist")${EDITOR:-vim} "$ALIASLIST";; *)true;; esac + exit fi #Sadly needs to be run without '&' for now, since it otherwise breaks start_scan variable startup & @@ -97,10 +100,21 @@ fi #Compile list of all Bluetooth IDS of paired devices (from bluetoothctl and from hardcoded list) -bt_IDS="$( ( bluetoothctl paired-devices && cat "$PAIRLIST" ) | sort -u | awk '{print $2}' )" +bt_IDS="$( ( bluetoothctl paired-devices && cat "$PAIRLIST" ) | awk '{print $2}' | sort -u )" #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