From bc8bd08be73e664d9c872dcd8662ade778288312 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Fri, 4 Jul 2025 18:56:04 +0200 Subject: flake: update --- common/home/scripts/bluemenu | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 common/home/scripts/bluemenu (limited to 'common/home/scripts') diff --git a/common/home/scripts/bluemenu b/common/home/scripts/bluemenu new file mode 100644 index 0000000..c27a859 --- /dev/null +++ b/common/home/scripts/bluemenu @@ -0,0 +1,24 @@ +#!/bin/sh + +dev=$(bluetoothctl devices | sed -e 's/Device \(..:..:..:..:..:..\) \(.*\)/\2|\1/g' | column -t -s '|' | while read -r device +do + id=$(echo "$device" | grep -o '..:..:..:..:..:..') + if bluetoothctl info "$id" | grep Connected | grep yes > /dev/null; then + printf " 󰂱 " + else + printf " " + fi + echo " $device" +done | wofi --dmenu | grep -o '..:..:..:..:..:..') + +[ -z "$dev" ] && exit + +name=$(bluetoothctl info "$dev" | grep Name: | sed 's/^\s*Name:\s*//g') + +if bluetoothctl info "$dev" | grep Connected | grep yes > /dev/null; then + bluetoothctl disconnect "$dev" + dunstify "Bluetooth" "Disconnected $name" +else + bluetoothctl connect "$dev" + dunstify "Bluetooth" "Connected $name" +fi -- cgit v1.2.3-70-g09d2