summaryrefslogtreecommitdiffstats
path: root/.bin/ag-audio
blob: 31b0fc3817f21ea632eb5cb98a0961d56a873aa8 (plain) (blame)
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
#!/bin/sh

__increase() {
	pactl set-sink-volume @DEFAULT_SINK@ "+${1:-10}%"
}

__decrease() {
	pactl set-sink-volume @DEFAULT_SINK@ "-${1:-10}%"
}

__mic_toggle() {
	pactl set-source-mute @DEFAULT_SOURCE@ toggle
}

__toggle() {
	pactl set-sink-mute @DEFAULT_SINK@ toggle
}

__next() {
	cmus-remote -n
}

__prev() {
	cmus-remote -r
}

__play() {
	cmus-remote -u
}

case "${1}" in
	i*)
		__increase "${2}"
		;;
	d*)
		__decrease "${2}"
		;;
	mic-t*)
		__mic_toggle
		;;
	t*)
		__toggle
		;;
	n*)
		__next
		;;
	pr*)
		__prev
		;;
	pl*)
		__play
		;;
esac

pactl get-source-mute @DEFAULT_SOURCE@ | grep no >/dev/null 2>&1
echo "${?}" > /sys/class/leds/platform::micmute/brightness

pactl get-sink-mute @DEFAULT_SINK@ | grep no >/dev/null 2>&1
echo "${?}" > /sys/class/leds/platform::mute/brightness

ag-status &>/dev/null
remember that computers suck.