aboutsummaryrefslogtreecommitdiff
path: root/extras/HOME/.local/bin/bluetooth-select.sh
blob: a0b8559015e548711cfcb82c09f53d14736d5e93 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash

devices="$(bluetoothctl -- devices | sed 's#^Device ##')"
selection="$(
  echo -e "$devices\nDisconnect" |
    dmenu -i -nf "#8888ff" -sb "#8888ff" -p "Connect Bluetooth" -l 12)"

macaddr="${selection%% *}"

if [[ "$macaddr" == "Disconnect" ]] ; then
  exec bluetoothctl -- disconnect
fi

exec bluetoothctl -- connect "$macaddr"