-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaudio.go
50 lines (36 loc) · 1.01 KB
/
audio.go
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
package main
import (
"os/exec"
)
func audioEventCallback(position *int, button *int) (f callbackFunc, err error) {
if *button == 0 {
return nil, audioCallback(*position)
}
return nil, exec.Command("alacritty", "-e", "pulsemixer").Start()
}
func audioCallback(position int) error {
b, err := exec.Command("pamixer", "--get-volume").Output()
if err != nil {
return err
}
sectionStatus[position] = string(b) + "%"
return nil
}
func audioUpEventCallback(position *int, button *int) (f callbackFunc, err error) {
*position = *position - 1
*button = 0
return audioEventCallback, exec.Command("pamixer", "-i", "2").Run()
}
func audioUpCallback(position int) error {
sectionStatus[position] = " 🔊"
return nil
}
func audioDownEventCallback(position *int, button *int) (f callbackFunc, err error) {
*position = *position + 1
*button = 0
return audioEventCallback, exec.Command("pamixer", "-d", "2").Run()
}
func audioDownCallback(position int) error {
sectionStatus[position] = "🔈 "
return nil
}