aboutsummaryrefslogtreecommitdiff
path: root/dmenu-audio
blob: ab3dc820c7bc33e4e1fd110bc1e25b8b03fc50f6 (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
62
63
#!/usr/bin/env bash

choices=" Connect BT headset\n󰂲 Disconnect BT headset\n󰓃 Select Output\n󰍬 Select Input\n󰝚 Playlists\n󰐎 Pause/Play Music\n📻 Radio\n✘ Exit"

result=$(echo -e $choices | dmenu -bw 4 -c -i -z 500 -l 8 -p "Audio")

case $result in 

    " Connect BT headset")
       headset="E8:07:BF:3C:5F:65"
       bluetoothctl connect $headset &> /dev/null
    ;;

    "󰂲 Disconnect BT headset")
       headset="E8:07:BF:3C:5F:65"
       bluetoothctl disconnect $headset &> /dev/null
    ;;

    "󰍬 Select Input")

        choices=$(pactl list short sources | cut -f2)
        choices="$choices Exit"
        result=$(echo $choices | sed 's/ /\'$'\n''/g' | dmenu -bw 4 -c -i -l 5 -p "Audio Input") || exit 0
        if [ $result = "Exit" ]; then
            exit 0
        fi
        pactl set-default-source $result
        notify-send -t 2000 -u normal "Audio input set to $result"
    
    ;;

    "󰓃 Select Output") 

        choices=$(pactl list short sinks | cut -f2)
        choices="$choices Exit"
        result=$(echo $choices | sed 's/ /\'$'\n''/g' | dmenu -bw 4 -c -i -l 5 -p "Audio Output") || exit 0
        if [ $result = "Exit" ]; then
            exit 0
        fi
        pactl set-default-sink $result
        notify-send -t 2000 -u normal "Audio output set to $result"
        exit 0
    ;;
    
    "󰝚 Playlists")
        dmenu-playmusic
        exit 0
    ;;

    "󰐎 Pause/Play Music")
        playerctl play-pause
        exit 0    
    ;;

    "📻 Radio")
        st -e pyradio
        exit 0
    ;;
    
  *) 
    exit 0
    ;; 
esac