This commit is contained in:
lordwelch 2017-11-06 22:09:55 -07:00
parent 72c447dfb8
commit 68798e24bc

View File

@ -24,7 +24,7 @@ type Keys []Key
type Args struct { type Args struct {
SHORTCUT string `arg:"-S,help:Keymap cycle shortcut"` SHORTCUT string `arg:"-S,help:Keymap cycle shortcut"`
ORDER []string `arg:positional,help:Order of keymaps` ORDER []string `arg:"positional,help:Order of keymaps"`
} }
const ( const (
@ -48,6 +48,7 @@ func Hold(press [8]byte, file io.Writer) {
} }
func changeKeymap(r rune, keys map[string]Keys, args Args, hidg0 *os.File, currentKeyMap *int) { func changeKeymap(r rune, keys map[string]Keys, args Args, hidg0 *os.File, currentKeyMap *int) {
fmt.Println(*currentKeyMap)
for keys[args.ORDER[(*currentKeyMap)]][r].name != r { for keys[args.ORDER[(*currentKeyMap)]][r].name != r {
Press([8]byte{LCTRL, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00}, hidg0) Press([8]byte{LCTRL, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00}, hidg0)
*currentKeyMap++ *currentKeyMap++
@ -64,7 +65,7 @@ func main() {
err error err error
keymapsF []os.FileInfo keymapsF []os.FileInfo
keys map[string]Keys keys map[string]Keys
cfgPath = path.Join(os.Getenv("XDG_CONFIG_HOME"), "hid") cfgPath = "./" //path.Join(os.Getenv("XDG_CONFIG_HOME"), "hid")
stdin = bufio.NewReader(os.Stdin) stdin = bufio.NewReader(os.Stdin)
currentKeyMap int currentKeyMap int
) )