dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit bf4ff7c84382500a723830256427ea8b755b37d6
parent 7ef39a1a469da6dd27bbb2832ea48f4d69ebafac
Author: Alex Balgavy <alexander.balgavy@spaceapplications.com>
Date:   Sat, 14 Dec 2024 15:47:42 +0100

dmenu-bluetoothctl: connect to bluetooth devices

Diffstat:
Ascripts/dmenu-bluetoothctl | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

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