#!/bin/sh # A simple but useful bluetooth script with dmenu bluetoothctl power on & if ! pgrep "scan" then bluetoothctl scan on & fi case "$(printf "connect\ndisconnect" | dmenu -p " > " )" in connect) bluetoothctl devices | sort | dmenu -p " > " -l 20 | cut -d' ' -f2 | xargs bluetoothctl connect | grep -i "success" | xargs -I % notify-send "Bluetooth" "%" -i bluetooth ;; disconnect) bluetoothctl disconnect notify-send -i bluetooth "Bluetooth" "Disconnected" ;; esac