diff --git a/src/speedwm-btctrl b/src/speedwm-btctrl index cf7b73d..0beae17 100755 --- a/src/speedwm-btctrl +++ b/src/speedwm-btctrl @@ -24,18 +24,25 @@ LIST_OPTIONS() { SELDEVICE_ACTION="$(printf -- "Options\nConnect\nDisconn ABOUT() { printf -- "speedwm-btctrl\nspmenu bluez frontend\n‎\nVersion %s\n" "$([ -e "/usr/share/speedwm/speedwm-extras-version" ] && cat /usr/share/speedwm/speedwm-extras-version || printf "1.9")" | $RUNLAUNCHER -l 40 -g 1 -p 'About'; pkill bluetoothctl; exit 0; } SEND_NOTIF() { [ "$NOTIF_SYSTEM" = "dnote" ] && command -v dnote && [ ! -z "$*" ] && printf "$2\n" | dnote -loc 4 && exit 1 || command -v notify-send && notify-send "$1" "$2" > /dev/null; } +LIST_BT() { + printf "$(bluetoothctl devices | cut -d\ -f3-)\n‎\nAbout\nExit" > /tmp/btctrl-file + sleep 3 + LIST_BT +} + # Enable bluetooth and scan for devices ENABLE_BT() { bluetoothctl power on > /dev/null && printf "Power: On\n" bluetoothctl scan on & # Start scanning for devices bluetoothctl devices | grep -q "No default controller" && printf "No Bluetooth controller was found.\n" && exit 1 - SELDEVICE="$(printf "$(bluetoothctl devices | cut -d\ -f3-)\n‎\nRefresh\nAbout\nExit" | $RUNLAUNCHER -l 12 -g 1 -p "Select a device")" + LIST_BT & + + SELDEVICE="$($RUNLAUNCHER -lf /tmp/btctrl-file -l 12 -g 1 -p "Select a device")" # Check what to do case "$SELDEVICE" in "") exit 0 ;; - "Refresh") ENABLE_BT ;; "Exit") exit 0 ;; "About") ABOUT ;; esac