2018-06-22 20:28:21 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2018-10-20 16:49:09 -07:00
|
|
|
"flag"
|
2018-06-22 20:28:21 -07:00
|
|
|
"fmt"
|
|
|
|
"os"
|
2018-10-20 16:49:09 -07:00
|
|
|
"timmy.narnian.us/hid/ghid"
|
2018-06-22 20:28:21 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
var (
|
2018-10-20 16:49:09 -07:00
|
|
|
SHORTCUT string
|
2018-06-22 20:28:21 -07:00
|
|
|
)
|
|
|
|
|
2018-10-20 16:49:09 -07:00
|
|
|
flag.StringVar(&SHORTCUT, "shortcut", "", "Keymap cycle shortcut")
|
|
|
|
flag.StringVar(&SHORTCUT, "s", "", "Keymap cycle shortcut")
|
|
|
|
flag.StringVar(&hid.KeymapPath, "path", os.ExpandEnv("$XDG_CONFIG_HOME"), "Path to config dir default: $XDG_CONFIG_HOME")
|
|
|
|
flag.StringVar(&hid.KeymapPath, "p", os.ExpandEnv("$XDG_CONFIG_HOME"), "Path to config dir default: $XDG_CONFIG_HOME")
|
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
hid.KeymapOrder = flag.Args()
|
|
|
|
|
2018-06-22 20:28:21 -07:00
|
|
|
fmt.Println(hid.KeymapPath)
|
|
|
|
|
2018-10-20 16:49:09 -07:00
|
|
|
file, err := os.OpenFile("/dev/hidg0", os.O_APPEND|os.O_WRONLY, 0755)
|
2018-06-22 20:28:21 -07:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2018-10-20 16:49:09 -07:00
|
|
|
hid.Hidg0 = file
|
|
|
|
defer file.Close()
|
|
|
|
|
|
|
|
hid.Write(os.Stdin)
|
2018-06-22 20:28:21 -07:00
|
|
|
|
2018-10-20 16:49:09 -07:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2018-06-22 20:28:21 -07:00
|
|
|
|
|
|
|
fmt.Println("Success!")
|
|
|
|
}
|