aboutsummaryrefslogtreecommitdiff
path: root/dmenu-connect
blob: 64194f9a870c05adb5bea79ad75df04a77db5dc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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