Fix return keymap to 0

No longer attempts to change keymap when there is only one
Fixed typo in keymap
This commit is contained in:
lordwelch 2018-01-24 14:43:33 -08:00
parent f882f599ff
commit 2697df4352
2 changed files with 18 additions and 15 deletions

View File

@ -81,11 +81,11 @@
}, },
"": { "": {
"modifier": ["LSHIFT"], "modifier": ["LSHIFT"],
"decimal": 46 "decimal": 45
}, },
"": { "": {
"modifier": ["LSHIFT"], "modifier": ["LSHIFT"],
"decimal": 45 "decimal": 46
}, },
"": { "": {
"modifier": ["NONE"], "modifier": ["NONE"],

View File

@ -47,13 +47,15 @@ func Hold(press [8]byte, file io.Writer) {
} }
func keymapto0(args Args, hidg0 *os.File, currentKeyMap *int) { func keymapto0(args Args, hidg0 *os.File, currentKeyMap *int) {
if len(args.ORDER) > 1 {
for i := 0; i <= len(args.ORDER)-(*currentKeyMap+1); i++ { for i := 0; i < len(args.ORDER)-(*currentKeyMap); i++ {
Press([8]byte{LALT, 0x00, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00}, hidg0) Press([8]byte{LALT, 0x00, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00}, hidg0)
} }
}
} }
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) {
if len(args.ORDER) > 1 {
for i := 0; i < len(args.ORDER); i++ { for i := 0; i < len(args.ORDER); i++ {
if keys[args.ORDER[(*currentKeyMap)]][string(r)].Decimal == 0 { if keys[args.ORDER[(*currentKeyMap)]][string(r)].Decimal == 0 {
Press([8]byte{LALT, 0x00, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00}, hidg0) Press([8]byte{LALT, 0x00, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00}, hidg0)
@ -67,6 +69,7 @@ func changeKeymap(r rune, keys map[string]Keys, args Args, hidg0 *os.File, curre
} }
} }
} }
}
} }
func main() { func main() {