-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathxinput.go
More file actions
40 lines (34 loc) · 736 Bytes
/
xinput.go
File metadata and controls
40 lines (34 loc) · 736 Bytes
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
package main
import (
"fmt"
"log"
"os/exec"
"regexp"
"time"
)
var xinputDevices = []*regexp.Regexp{
regexp.MustCompile(`↳ Contour Design ShuttlePRO v2\s+id=(\d+)\s`),
}
func disableXInputPointer() {
for {
cnt, err := exec.Command("xinput", "list").Output()
if err != nil {
log.Println("Couldn't list xinput:", err)
goto end
}
for _, dev := range xinputDevices {
matches := dev.FindStringSubmatch(string(cnt))
if matches == nil {
continue
}
id := matches[1]
fmt.Println("Disabling XInput id:", id)
if err := exec.Command("xinput", "disable", id).Run(); err != nil {
log.Println("Couldn't disable xinput device:", err)
goto end
}
}
end:
time.Sleep(60 * time.Second)
}
}