#!/bin/bash if [[ -z "$ROFI" ]] ; then ROFI='rofi -dmenu' fi devices="$(bluetoothctl -- devices | sed 's#^Device ##')" selection="$( echo -e "$devices\nDisconnect" | $ROFI -i -p "Connect Bluetooth" \ -theme-str '* {theme-color: #8888ff;}' \ -dmenu)" macaddr="${selection%% *}" if [[ "$macaddr" == "Disconnect" ]] ; then exec bluetoothctl -- disconnect fi exec bluetoothctl -- connect "$macaddr"