summaryrefslogtreecommitdiffstats
path: root/.bin/ag-audio
blob: c39fd61a95cc04e9f17b9f3468da01eb3a4da52a (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
#!/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
	pactl get-source-mute @DEFAULT_SOURCE@ | grep no >/dev/null 2>&1
	echo "${?}" > /sys/class/leds/platform::micmute/brightness
}

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

__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

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