diff --git a/ghid/keyboard.go b/ghid/keyboard.go index 096189f..fe156df 100644 --- a/ghid/keyboard.go +++ b/ghid/keyboard.go @@ -137,6 +137,10 @@ func (k *Keyboard) Write(p []byte) (int, error) { } index += s + n break press + case r == '␀': + // Causes immediate key press useful for modifier keys + index += s + break press default: // Calculate next modifier byte @@ -149,12 +153,18 @@ func (k *Keyboard) Write(p []byte) (int, error) { if i == 2 { flag = mod } else if flag != mod { - break press + // This is the second key press if the previous one was a modifier only Decimal == 0 then take the current key as well + if report[i-1] != 0 { + break press + } + // Add the modifier of the current key eg 'D' adds shift 'd' does not + flag |= mod + fmt.Printf("this press is modified %d %v\n", flag, cur) } - // Check for duplicate key press. You can't press a key if it is already pressed. + // Check for duplicate key press. You can't press a key if it is already pressed, unless it is 0 indicating a modifier. for u := 2; u < i; u++ { - if cur.Decimal == report[u] { + if cur.Decimal == report[u] && cur.Decimal != 0 { break press } } @@ -162,7 +172,11 @@ func (k *Keyboard) Write(p []byte) (int, error) { report[i] = cur.Decimal index += s if k.PressDelay > 0 { - break press + // This is the first key press if this is a modifier only Decimal == 0 then take the next key as well + if report[i] != 0 { + break press + } + fmt.Printf("this press is a modifier %v\n", cur) } } report[0] = flag diff --git a/keymaps/dvorak.json b/keymaps/dvorak.json index 1f1ee58..7023740 100644 --- a/keymaps/dvorak.json +++ b/keymaps/dvorak.json @@ -387,6 +387,96 @@ "modifier": ["NONE"], "decimal": 44 }, + "⎋": { + "modifier": [""], + "decimal": 41, + "PressDelayDelimiter": false + }, + "↘": { + "modifier": [""], + "decimal": 77, + "PressDelayDelimiter": false + }, + "↖": { + "modifier": [""], + "decimal": 74, + "PressDelayDelimiter": false + }, + "⇪": { + "modifier": [""], + "decimal": 57, + "PressDelayDelimiter": false + }, + "⌃": { + "modifier": ["LCTRL"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "⇧": { + "modifier": ["LSHIFT"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "⌥": { + "modifier": ["LALT"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "⌘": { + "modifier": ["LSUPER"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "⊞": { + "modifier": ["LSUPER"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "→": { + "modifier": [""], + "decimal": 79, + "PressDelayDelimiter": false + }, + "←": { + "modifier": [""], + "decimal": 80, + "PressDelayDelimiter": false + }, + "↑": { + "modifier": [""], + "decimal": 81, + "PressDelayDelimiter": false + }, + "↓": { + "modifier": [""], + "decimal": 82, + "PressDelayDelimiter": false + }, + "⇞": { + "modifier": [""], + "decimal": 75, + "PressDelayDelimiter": false + }, + "⇟": { + "modifier": [""], + "decimal": 78, + "PressDelayDelimiter": false + }, + "⌫": { + "modifier": [""], + "decimal": 42, + "PressDelayDelimiter": false + }, + "⌦": { + "modifier": [""], + "decimal": 76, + "PressDelayDelimiter": false + }, + "␀": { + "modifier": [""], + "decimal": 0, + "PressDelayDelimiter": false + }, "⏲": { "modifier": ["NONE"], "decimal": 0, diff --git a/keymaps/qwerty.json b/keymaps/qwerty.json index b36516d..8f5fe7a 100644 --- a/keymaps/qwerty.json +++ b/keymaps/qwerty.json @@ -387,6 +387,101 @@ "modifier": ["NONE"], "decimal": 44 }, + "␛": { + "modifier": [""], + "decimal": 41, + "PressDelayDelimiter": false + }, + "⎋": { + "modifier": [""], + "decimal": 41, + "PressDelayDelimiter": false + }, + "↘": { + "modifier": [""], + "decimal": 77, + "PressDelayDelimiter": false + }, + "↖": { + "modifier": [""], + "decimal": 74, + "PressDelayDelimiter": false + }, + "⇪": { + "modifier": [""], + "decimal": 57, + "PressDelayDelimiter": false + }, + "⌃": { + "modifier": ["LCTRL"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "⇧": { + "modifier": ["LSHIFT"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "⌥": { + "modifier": ["LALT"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "⌘": { + "modifier": ["LSUPER"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "⊞": { + "modifier": ["LSUPER"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "→": { + "modifier": [""], + "decimal": 79, + "PressDelayDelimiter": false + }, + "←": { + "modifier": [""], + "decimal": 80, + "PressDelayDelimiter": false + }, + "↑": { + "modifier": [""], + "decimal": 81, + "PressDelayDelimiter": false + }, + "↓": { + "modifier": [""], + "decimal": 82, + "PressDelayDelimiter": false + }, + "⇞": { + "modifier": [""], + "decimal": 75, + "PressDelayDelimiter": false + }, + "⇟": { + "modifier": [""], + "decimal": 78, + "PressDelayDelimiter": false + }, + "⌫": { + "modifier": [""], + "decimal": 42, + "PressDelayDelimiter": false + }, + "⌦": { + "modifier": [""], + "decimal": 76, + "PressDelayDelimiter": false + }, + "␀": { + "modifier": [""], + "decimal": 0, + "PressDelayDelimiter": false + }, "⏲": { "modifier": ["NONE"], "decimal": 0, diff --git a/keymaps/tengwar-f.json b/keymaps/tengwar-f.json index 20eb8bb..ef4384c 100644 --- a/keymaps/tengwar-f.json +++ b/keymaps/tengwar-f.json @@ -387,6 +387,96 @@ "modifier": ["NONE"], "decimal": 44 }, + "⎋": { + "modifier": [""], + "decimal": 41, + "PressDelayDelimiter": false + }, + "↘": { + "modifier": [""], + "decimal": 77, + "PressDelayDelimiter": false + }, + "↖": { + "modifier": [""], + "decimal": 74, + "PressDelayDelimiter": false + }, + "⇪": { + "modifier": [""], + "decimal": 57, + "PressDelayDelimiter": false + }, + "⌃": { + "modifier": ["LCTRL"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "⇧": { + "modifier": ["LSHIFT"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "⌥": { + "modifier": ["LALT"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "⌘": { + "modifier": ["LSUPER"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "⊞": { + "modifier": ["LSUPER"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "→": { + "modifier": [""], + "decimal": 79, + "PressDelayDelimiter": false + }, + "←": { + "modifier": [""], + "decimal": 80, + "PressDelayDelimiter": false + }, + "↑": { + "modifier": [""], + "decimal": 81, + "PressDelayDelimiter": false + }, + "↓": { + "modifier": [""], + "decimal": 82, + "PressDelayDelimiter": false + }, + "⇞": { + "modifier": [""], + "decimal": 75, + "PressDelayDelimiter": false + }, + "⇟": { + "modifier": [""], + "decimal": 78, + "PressDelayDelimiter": false + }, + "⌫": { + "modifier": [""], + "decimal": 42, + "PressDelayDelimiter": false + }, + "⌦": { + "modifier": [""], + "decimal": 76, + "PressDelayDelimiter": false + }, + "␀": { + "modifier": [""], + "decimal": 0, + "PressDelayDelimiter": false + }, "⏲": { "modifier": ["NONE"], "decimal": 0, diff --git a/keymaps/tengwar-u.json b/keymaps/tengwar-u.json index 6034f29..0443a85 100644 --- a/keymaps/tengwar-u.json +++ b/keymaps/tengwar-u.json @@ -375,6 +375,96 @@ "modifier": ["NONE"], "decimal": 44 }, + "⎋": { + "modifier": [""], + "decimal": 41, + "PressDelayDelimiter": false + }, + "↘": { + "modifier": [""], + "decimal": 77, + "PressDelayDelimiter": false + }, + "↖": { + "modifier": [""], + "decimal": 74, + "PressDelayDelimiter": false + }, + "⇪": { + "modifier": [""], + "decimal": 57, + "PressDelayDelimiter": false + }, + "⌃": { + "modifier": ["LCTRL"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "⇧": { + "modifier": ["LSHIFT"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "⌥": { + "modifier": ["LALT"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "⌘": { + "modifier": ["LSUPER"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "⊞": { + "modifier": ["LSUPER"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "→": { + "modifier": [""], + "decimal": 79, + "PressDelayDelimiter": false + }, + "←": { + "modifier": [""], + "decimal": 80, + "PressDelayDelimiter": false + }, + "↑": { + "modifier": [""], + "decimal": 81, + "PressDelayDelimiter": false + }, + "↓": { + "modifier": [""], + "decimal": 82, + "PressDelayDelimiter": false + }, + "⇞": { + "modifier": [""], + "decimal": 75, + "PressDelayDelimiter": false + }, + "⇟": { + "modifier": [""], + "decimal": 78, + "PressDelayDelimiter": false + }, + "⌫": { + "modifier": [""], + "decimal": 42, + "PressDelayDelimiter": false + }, + "⌦": { + "modifier": [""], + "decimal": 76, + "PressDelayDelimiter": false + }, + "␀": { + "modifier": [""], + "decimal": 0, + "PressDelayDelimiter": false + }, "⏲": { "modifier": ["NONE"], "decimal": 0, diff --git a/keymaps/tiro.json b/keymaps/tiro.json index df887c7..9189586 100644 --- a/keymaps/tiro.json +++ b/keymaps/tiro.json @@ -559,6 +559,96 @@ "modifier": ["NONE"], "decimal": 44 }, + "⎋": { + "modifier": [""], + "decimal": 41, + "PressDelayDelimiter": false + }, + "↘": { + "modifier": [""], + "decimal": 77, + "PressDelayDelimiter": false + }, + "↖": { + "modifier": [""], + "decimal": 74, + "PressDelayDelimiter": false + }, + "⇪": { + "modifier": [""], + "decimal": 57, + "PressDelayDelimiter": false + }, + "⌃": { + "modifier": ["LCTRL"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "⇧": { + "modifier": ["LSHIFT"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "⌥": { + "modifier": ["LALT"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "⌘": { + "modifier": ["LSUPER"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "⊞": { + "modifier": ["LSUPER"], + "decimal": 0, + "PressDelayDelimiter": false + }, + "→": { + "modifier": [""], + "decimal": 79, + "PressDelayDelimiter": false + }, + "←": { + "modifier": [""], + "decimal": 80, + "PressDelayDelimiter": false + }, + "↑": { + "modifier": [""], + "decimal": 81, + "PressDelayDelimiter": false + }, + "↓": { + "modifier": [""], + "decimal": 82, + "PressDelayDelimiter": false + }, + "⇞": { + "modifier": [""], + "decimal": 75, + "PressDelayDelimiter": false + }, + "⇟": { + "modifier": [""], + "decimal": 78, + "PressDelayDelimiter": false + }, + "⌫": { + "modifier": [""], + "decimal": 42, + "PressDelayDelimiter": false + }, + "⌦": { + "modifier": [""], + "decimal": 76, + "PressDelayDelimiter": false + }, + "␀": { + "modifier": [""], + "decimal": 0, + "PressDelayDelimiter": false + }, "⏲": { "modifier": ["NONE"], "decimal": 0,