dmenu-bluetoothctl (456B)
1 #!/bin/sh 2 set -x 3 mac="$(bluetoothctl devices \ 4 | ruby -e ' 5 devices = ARGF.readlines.each_with_object(Hash.new) { |l,h| _, mac, *rest = l.chomp.split; h[rest.join(" ")] = mac } 6 choice = `printf '%s' "#{devices.keys.join("\n")}" | dmenu -i -l 5 -p "Bluetooth> "`.chomp 7 abort if choice.nil? or not devices.key? choice 8 print devices[choice]')" 9 10 [ -n "$mac" ] || { printf 'Nothing selected.' >&2; exit 1; } 11 bluetoothctl connect "$mac"