aboutsummaryrefslogtreecommitdiff
path: root/dmenu-connect
diff options
context:
space:
mode:
authorPhilip Wittamore <philip@wittamore.com>2025-06-16 18:33:27 +0200
committerPhilip Wittamore <philip@wittamore.com>2025-06-16 18:33:27 +0200
commitce2d80f5c5104c31950a30eac0a6a86ba71c3163 (patch)
tree48417c3b848ae7f3808fbb1d43bb521a8115960f /dmenu-connect
parent00e2a2f919bb26ca1493ca2842dd7af1791ae587 (diff)
downloadscripts-ce2d80f5c5104c31950a30eac0a6a86ba71c3163.tar.gz
scripts-ce2d80f5c5104c31950a30eac0a6a86ba71c3163.tar.bz2
scripts-ce2d80f5c5104c31950a30eac0a6a86ba71c3163.zip
update
Diffstat (limited to 'dmenu-connect')
-rwxr-xr-xdmenu-connect61
1 files changed, 61 insertions, 0 deletions
diff --git a/dmenu-connect b/dmenu-connect
new file mode 100755
index 0000000..64194f9
--- /dev/null
+++ b/dmenu-connect
@@ -0,0 +1,61 @@
+#!/usr/bin/env bash
+
+# generic connection manager
+
+# Bluetooth headset on Thinkpad X220
+# bt controller 60:D8:19:AE:22:77 is the default
+# bt controller 48:51:B7:EB:7B:B5 is removed in udev
+
+headset="E8:07:BF:3C:5F:65"
+microphone="alsa_input.usb-MUSIC-BOOST_USB_Microphone_MB-306-00.mono-fallback"
+
+choices="Connect BT Headset\nDisconnect BT Headset\nConnect USB Micro\nConnect rnnoise filter\nExit menu"
+
+selected=$(echo -e $choices | dmenu -c -i -z 500 -l 5 -p "Connector")
+
+#echo $selected
+
+case $selected in
+
+ "Connect BT Headset")
+ bluetoothctl connect $headset &> /dev/null
+ sleep 1
+ defsink=$(pactl get-default-sink)
+ dunstify -t 5000 -a "BT Headset" -u low -i media-removable-symbolic \
+ -h string:x-dunst-stack-tag:bt-headset "Default sink = $defsink"
+ ;;
+
+ "Disconnect BT Headset")
+ bluetoothctl disconnect $headset &> /dev/null
+ sleep 1
+ defsink=$(pactl get-default-sink)
+ dunstify -t 5000 -a "BT Headset" -u low -i media-removable-symbolic \
+ -h string:x-dunst-stack-tag:bt-headset "Default sink = $defsink"
+ ;;
+
+ "Connect USB Micro")
+ pactl set-default-source $microphone &> /dev/null
+ sleep 1
+ defsource=$(pactl get-default-source)
+ dunstify -t 5000 -a "Microphone" -u low -i media-removable-symbolic \
+ -h string:x-dunst-stack-tag:usb-microphone "Default source = $defsource"
+ ;;
+
+ "Connect rnnoise filter")
+ pactl set-default-source "rnnoise_source" &> /dev/null
+ sleep 1
+ defsource=$(pactl get-default-source)
+ dunstify -t 5000 -a "Microphone" -u low -i media-removable-symbolic \
+ -h string:x-dunst-stack-tag:usb-microphone "Default source = $defsource"
+ ;;
+
+ "Exit menu")
+ exit 0
+ ;;
+
+ *)
+ ;;
+esac
+
+
+