summaryrefslogtreecommitdiff
path: root/common/home/scripts
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2025-07-04 18:56:04 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2025-07-04 18:56:04 +0200
commitbc8bd08be73e664d9c872dcd8662ade778288312 (patch)
tree794f923e7f4b9dea5c5ec4f3a3ad7cb7c5e4c11e /common/home/scripts
parent75bdc69393791624084bf68c4d9a93219e6e0a0f (diff)
flake: update
Diffstat (limited to 'common/home/scripts')
-rw-r--r--common/home/scripts/bluemenu24
1 files changed, 24 insertions, 0 deletions
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