Compare commits

..

37 Commits

Author SHA1 Message Date
Timmy Welch
d70c691ac7 Fix shortcut parsing and keymap list 2024-04-17 17:30:19 -07:00
Timmy Welch
572af746fa Change module location 2024-04-17 17:14:23 -07:00
Timmy Welch
f6967e5f83 Improve keymap changing 2024-04-17 17:14:09 -07:00
lordwelch
5a4c207159 Fix flags 2022-05-13 09:49:13 -07:00
lordwelch
0206ba448e Enable go module
Set go version to 1.18
Add arguments to set press delay and release delay
Add better handling for unknown characters
2022-05-13 09:44:04 -07:00
lordwelch
0bbf455bc7 Remove logging 2021-02-26 13:11:19 -08:00
lordwelch
a594b3044c Add support for modifier keys (eg CTRL+D, CTRL+SHIFT+D) 2021-02-26 12:32:23 -08:00
lordwelch
7244a85ecd Fix dvorak keymap 2020-03-18 15:13:42 -07:00
lordwelch
d1b2d5623a Add a clean exit for not providing a keymap to use 2020-03-05 23:56:51 -08:00
lordwelch
c2f2d16097 Fix Nil map error 2020-03-05 14:46:17 -08:00
lordwelch
7441c3e637 Use a struct as a base instead of bare functions in a library
Added error reporting for Keyboard type
Added a file flag to read the input from
Fixed odd keymap path handling
2020-03-05 12:52:27 -08:00
lordwelch
03ec054d8b Fix an off by one error 2020-01-31 19:44:33 -08:00
lordwelch
a0e2601d2f keymaps
Fix Dvorak ordering
Remake tengwar-f
2019-08-04 16:27:54 -07:00
lordwelch
45f9df45bb cleanup 2018-11-09 17:23:07 -08:00
lordwelch
349cd91f66 Fix typo and fix ReleaseDelay assignment 2018-11-07 18:08:02 -08:00
lordwelch
5fbef47dde remove unused const and ignore single newline directly after delay 2018-11-05 11:47:11 -08:00
lordwelch
0b2415ac40 cleaned up some code
handle delays better
add ability to have comments
add defaults to keymaps
2018-11-04 23:59:13 -08:00
lordwelch
bf090a5b67 verbose + fix delay 2018-10-29 22:31:36 -07:00
lordwelch
cd5638b988 sync 2018-10-29 22:07:51 -07:00
lordwelch
39176aac3c enforce delay and add delay to keymap 2018-10-29 21:57:36 -07:00
lordwelch
02aa4cd6c2 restructure 2018-10-20 16:50:08 -07:00
lordwelch
47d8950fd4 cleanup 2018-10-20 16:49:09 -07:00
lordwelch
9d04ddc8be Restructure to library
Implemented io.Writer interface. Might want to use a different interface
add a delay character
2018-06-22 20:28:21 -07:00
lordwelch
394b44e9df Make report carry as many keys as possible (over 50% speedup)
Need to look into not sending a blank report every time
2018-01-25 22:26:31 -08:00
lordwelch
2697df4352 Fix return keymap to 0
No longer attempts to change keymap when there is only one
Fixed typo in keymap
2018-01-24 14:43:33 -08:00
lordwelch
f882f599ff Make argument required 2018-01-24 12:58:03 -08:00
lordwelch
f264f9c017 Apparently I don't look at my source code before commiting 2018-01-24 12:32:42 -08:00
lordwelch
6b6b3db9cc Changed modifier from string to array of string updated code accordingly
Added tiro keymap
2018-01-24 10:21:44 -08:00
lordwelch
b08c2fa792 Organized qwerty by row
Added tengwar layouts
Made the changeKeymap function actually work
Added keymapto0 so that the app consistently types correctly
2018-01-23 23:12:41 -08:00
lordwelch
8b4a2dc9f9 Do not panic if key is not in keymap 2017-11-24 21:48:21 -07:00
lordwelch
ef46068793 Missed some printfs 2017-11-10 14:35:03 -07:00
lordwelch
7b401e28b8 Forgot to open the correct file 2017-11-10 14:29:40 -07:00
lordwelch
ef37cc4317 Use XDG_CONFIG_HOME
Remove extra output
2017-11-10 14:15:24 -07:00
lordwelch
be99ea3d81 Reduce output
Switch to using A map to get the flag value
2017-11-08 11:15:58 -07:00
lordwelch
4cbe2d8e67 Stop unnecessary panic 2017-11-07 14:57:24 -07:00
lordwelch
586e3d2010 Add tab,newline and space 2017-11-07 14:37:37 -07:00
lordwelch
cd28bee157 Sort and fmt 2017-11-07 11:52:01 -07:00
12 changed files with 3195 additions and 1251 deletions

View File

@ -1,377 +0,0 @@
: {
"modifier": "00000000",
"key": 39
},
: {
"modifier": "00000000",
"key": 30
},
: {
"modifier": "00000000",
"key": 31
},
: {
"modifier": "00000000",
"key": 32
},
: {
"modifier": "00000000",
"key": 33
},
: {
"modifier": "00000000",
"key": 34
},
: {
"modifier": "00000000",
"key": 35
},
: {
"modifier": "00000000",
"key": 36
},
: {
"modifier": "00000000",
"key": 37
},
: {
"modifier": "00000000",
"key": 38
},
: {
"modifier": "00000000",
"key": 53
},
: {
"modifier": "00000000",
"key": 47
},
: {
"modifier": "00000000",
"key": 48
},
: {
"modifier": "00000000",
"key": 52
},
: {
"modifier": "00000000",
"key": 54
},
: {
"modifier": "00000000",
"key": 55
},
: {
"modifier": "00000000",
"key": 19
},
: {
"modifier": "00000000",
"key": 28
},
: {
"modifier": "00000000",
"key": 9
},
: {
"modifier": "00000000",
"key": 10
},
: {
"modifier": "00000000",
"key": 6
},
: {
"modifier": "00000000",
"key": 21
},
: {
"modifier": "00000000",
"key": 15
},
: {
"modifier": "00000000",
"key": 56
},
: {
"modifier": "00000000",
"key": 46
},
: {
"modifier": "00000000",
"key": 49
},
: {
"modifier": "00000000",
"key": 4
},
: {
"modifier": "00000000",
"key": 18
},
: {
"modifier": "00000000",
"key": 8
},
: {
"modifier": "00000000",
"key": 24
},
: {
"modifier": "00000000",
"key": 12
},
: {
"modifier": "00000000",
"key": 7
},
: {
"modifier": "00000000",
"key": 11
},
: {
"modifier": "00000000",
"key": 23
},
: {
"modifier": "00000000",
"key": 17
},
: {
"modifier": "00000000",
"key": 22
},
: {
"modifier": "00000000",
"key": 45
},
: {
"modifier": "00000000",
"key": 51
},
: {
"modifier": "00000000",
"key": 20
},
: {
"modifier": "00000000",
"key": 13
},
: {
"modifier": "00000000",
"key": 14
},
: {
"modifier": "00000000",
"key": 27
},
: {
"modifier": "00000000",
"key": 5
},
: {
"modifier": "00000000",
"key": 16
},
: {
"modifier": "00000000",
"key": 26
},
: {
"modifier": "00000000",
"key": 25
},
: {
"modifier": "00000000",
"key": 29
},
: {
"modifier": "00000010",
"key": 53
},
: {
"modifier": "00000010",
"key": 30
},
: {
"modifier": "00000010",
"key": 31
},
: {
"modifier": "00000010",
"key": 32
},
: {
"modifier": "00000010",
"key": 33
},
: {
"modifier": "00000010",
"key": 34
},
: {
"modifier": "00000010",
"key": 35
},
: {
"modifier": "00000010",
"key": 36
},
: {
"modifier": "00000010",
"key": 37
},
: {
"modifier": "00000010",
"key": 38
},
: {
"modifier": "00000010",
"key": 39
},
: {
"modifier": "00000010",
"key": 47
},
: {
"modifier": "00000010",
"key": 48
},
: {
"modifier": "00000010",
"key": 52
},
: {
"modifier": "00000010",
"key": 54
},
: {
"modifier": "00000010",
"key": 55
},
: {
"modifier": "00000010",
"key": 19
},
: {
"modifier": "00000010",
"key": 28
},
: {
"modifier": "00000010",
"key": 9
},
: {
"modifier": "00000010",
"key": 10
},
: {
"modifier": "00000010",
"key": 6
},
: {
"modifier": "00000010",
"key": 21
},
: {
"modifier": "00000010",
"key": 15
},
: {
"modifier": "00000010",
"key": 56
},
: {
"modifier": "00000010",
"key": 46
},
: {
"modifier": "00000010",
"key": 49
},
: {
"modifier": "00000010",
"key": 4
},
: {
"modifier": "00000010",
"key": 18
},
: {
"modifier": "00000010",
"key": 8
},
: {
"modifier": "00000010",
"key": 24
},
: {
"modifier": "00000010",
"key": 12
},
: {
"modifier": "00000010",
"key": 7
},
: {
"modifier": "00000010",
"key": 11
},
: {
"modifier": "00000010",
"key": 23
},
: {
"modifier": "00000010",
"key": 17
},
: {
"modifier": "00000010",
"key": 22
},
: {
"modifier": "00000010",
"key": 45
},
: {
"modifier": "00000010",
"key": 51
},
: {
"modifier": "00000010",
"key": 20
},
: {
"modifier": "00000010",
"key": 13
},
: {
"modifier": "00000010",
"key": 14
},
: {
"modifier": "00000010",
"key": 27
},
: {
"modifier": "00000010",
"key": 5
},
: {
"modifier": "00000010",
"key": 16
},
: {
"modifier": "00000010",
"key": 26
},
: {
"modifier": "00000010",
"key": 25
},
: {
"modifier": "00000010",
"key": 29
}

View File

@ -1,378 +0,0 @@
{
"0" : {
"modifier": "00000000",
"decimal": 39
},
"1" : {
"modifier": "00000000",
"decimal": 30
},
"2" : {
"modifier": "00000000",
"decimal": 31
},
"3" : {
"modifier": "00000000",
"decimal": 32
},
"4" : {
"modifier": "00000000",
"decimal": 33
},
"5" : {
"modifier": "00000000",
"decimal": 34
},
"6" : {
"modifier": "00000000",
"decimal": 35
},
"7" : {
"modifier": "00000000",
"decimal": 36
},
"8" : {
"modifier": "00000000",
"decimal": 37
},
"9" : {
"modifier": "00000000",
"decimal": 38
},
"`" : {
"modifier": "00000000",
"decimal": 53
},
"/" : {
"modifier": "00000000",
"decimal": 47
},
"=" : {
"modifier": "00000000",
"decimal": 48
},
"-" : {
"modifier": "00000000",
"decimal": 52
},
"w" : {
"modifier": "00000000",
"decimal": 54
},
"v" : {
"modifier": "00000000",
"decimal": 55
},
"l" : {
"modifier": "00000000",
"decimal": 19
},
"f" : {
"modifier": "00000000",
"decimal": 28
},
"u" : {
"modifier": "00000000",
"decimal": 9
},
"i" : {
"modifier": "00000000",
"decimal": 10
},
"j" : {
"modifier": "00000000",
"decimal": 6
},
"p" : {
"modifier": "00000000",
"decimal": 21
},
"n" : {
"modifier": "00000000",
"decimal": 15
},
"z" : {
"modifier": "00000000",
"decimal": 56
},
"]" : {
"modifier": "00000000",
"decimal": 46
},
"\\" : {
"modifier": "00000000",
"decimal": 49
},
"a" : {
"modifier": "00000000",
"decimal": 4
},
"r" : {
"modifier": "00000000",
"decimal": 18
},
"." : {
"modifier": "00000000",
"decimal": 8
},
"g" : {
"modifier": "00000000",
"decimal": 24
},
"c" : {
"modifier": "00000000",
"decimal": 12
},
"e" : {
"modifier": "00000000",
"decimal": 7
},
"d" : {
"modifier": "00000000",
"decimal": 11
},
"y" : {
"modifier": "00000000",
"decimal": 23
},
"b" : {
"modifier": "00000000",
"decimal": 17
},
"o" : {
"modifier": "00000000",
"decimal": 22
},
"[" : {
"modifier": "00000000",
"decimal": 45
},
"s" : {
"modifier": "00000000",
"decimal": 51
},
"'" : {
"modifier": "00000000",
"decimal": 20
},
"h" : {
"modifier": "00000000",
"decimal": 13
},
"t" : {
"modifier": "00000000",
"decimal": 14
},
"q" : {
"modifier": "00000000",
"decimal": 27
},
"x" : {
"modifier": "00000000",
"decimal": 5
},
"m" : {
"modifier": "00000000",
"decimal": 16
},
"," : {
"modifier": "00000000",
"decimal": 26
},
"k" : {
"modifier": "00000000",
"decimal": 25
},
";" : {
"modifier": "00000000",
"decimal": 29
},
"~" : {
"modifier": "00000010",
"decimal": 53
},
"!" : {
"modifier": "00000010",
"decimal": 30
},
"@" : {
"modifier": "00000010",
"decimal": 31
},
"#" : {
"modifier": "00000010",
"decimal": 32
},
"$" : {
"modifier": "00000010",
"decimal": 33
},
"%" : {
"modifier": "00000010",
"decimal": 34
},
"^" : {
"modifier": "00000010",
"decimal": 35
},
"&" : {
"modifier": "00000010",
"decimal": 36
},
"*" : {
"modifier": "00000010",
"decimal": 37
},
"(" : {
"modifier": "00000010",
"decimal": 38
},
")" : {
"modifier": "00000010",
"decimal": 39
},
"?" : {
"modifier": "00000010",
"decimal": 47
},
"+" : {
"modifier": "00000010",
"decimal": 48
},
"_" : {
"modifier": "00000010",
"decimal": 52
},
"W" : {
"modifier": "00000010",
"decimal": 54
},
"V" : {
"modifier": "00000010",
"decimal": 55
},
"L" : {
"modifier": "00000010",
"decimal": 19
},
"F" : {
"modifier": "00000010",
"decimal": 28
},
"U" : {
"modifier": "00000010",
"decimal": 9
},
"I" : {
"modifier": "00000010",
"decimal": 10
},
"J" : {
"modifier": "00000010",
"decimal": 6
},
"P" : {
"modifier": "00000010",
"decimal": 21
},
"N" : {
"modifier": "00000010",
"decimal": 15
},
"Z" : {
"modifier": "00000010",
"decimal": 56
},
"}" : {
"modifier": "00000010",
"decimal": 46
},
"|" : {
"modifier": "00000010",
"decimal": 49
},
"A" : {
"modifier": "00000010",
"decimal": 4
},
"R" : {
"modifier": "00000010",
"decimal": 18
},
">" : {
"modifier": "00000010",
"decimal": 8
},
"G" : {
"modifier": "00000010",
"decimal": 24
},
"C" : {
"modifier": "00000010",
"decimal": 12
},
"E" : {
"modifier": "00000010",
"decimal": 7
},
"D" : {
"modifier": "00000010",
"decimal": 11
},
"Y" : {
"modifier": "00000010",
"decimal": 23
},
"B" : {
"modifier": "00000010",
"decimal": 17
},
"O" : {
"modifier": "00000010",
"decimal": 22
},
"{" : {
"modifier": "00000010",
"decimal": 45
},
"S" : {
"modifier": "00000010",
"decimal": 51
},
"\"" : {
"modifier": "00000010",
"decimal": 20
},
"H" : {
"modifier": "00000010",
"decimal": 13
},
"T" : {
"modifier": "00000010",
"decimal": 14
},
"Q" : {
"modifier": "00000010",
"decimal": 27
},
"X" : {
"modifier": "00000010",
"decimal": 5
},
"M" : {
"modifier": "00000010",
"decimal": 16
},
"<" : {
"modifier": "00000010",
"decimal": 26
},
"K" : {
"modifier": "00000010",
"decimal": 25
},
":" : {
"modifier": "00000010",
"decimal": 29
}
}

328
ghid/keyboard.go Normal file
View File

@ -0,0 +1,328 @@
package hid
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"path"
"strconv"
"strings"
"time"
"unicode"
"unicode/utf8"
)
type syncer interface {
Sync() error
}
// A Key is a USB HID value
type Key struct {
Modifier []string `json:"modifier"`
Decimal byte `json:"decimal"`
PressDelayDelimiter bool `json:"pressDelayDelimiter,omitempty"`
ReleaseDelayDelimiter bool `json:"releaseDelayDelimiter,omitempty"`
Comment bool `json:"comment,omitempty"`
}
// A Keymap is a json representation of the unicode rune mapped to its USB HID value
type Keymap map[string]Key
type Keyboard struct {
PressDelay time.Duration // PressDelay is the time in ms to delay before sending a press event
ReleaseDelay time.Duration // ReleaseDelay is the time in ms to wait before sending the release event
KeymapOrder []string // Keymap Order is the order in which the specified keymaps cycle on the computer
KeymapShortcut [8]byte // KeymapShortcut is the key combo that will cycle the current keymap by one
ErrOnUnknownKey bool // ErrOnUnknownKey whether or not to fail if the unicode rune is invalid or is not in the specified keymaps
KeymapPath string // KeymapPath is the pathe to where the keymap files are stored
currentKeyMap int
keymaps map[string]Keymap
flags map[string]byte
Hidg0 io.Writer
}
// bit flag of modifier keys
const (
LCTRL byte = 1 << iota
LSHIFT
LALT
LSUPER
RCTRL
RSHIFT
RALT
RSUPER
NONE = 0
)
var (
Modifiers = map[string]byte{
"LSHIFT": LSHIFT,
"LCTRL": LCTRL,
"LALT": LALT,
"LSUPER": LSUPER,
"RSHIFT": RSHIFT,
"RCTRL": RCTRL,
"RALT": RALT,
"RSUPER": RSUPER,
"NONE": NONE,
}
AllModifiers = []string{
"LSHIFT",
"LCTRL",
"LALT",
"LSUPER",
"RSHIFT",
"RCTRL",
"RALT",
"RSUPER",
"NONE",
}
)
func NewKeyboard(Modifiers map[string]byte, kemapOrder []string, KeymapPath string, hidg0 io.Writer) *Keyboard {
return &Keyboard{
flags: Modifiers,
KeymapOrder: kemapOrder,
KeymapPath: KeymapPath,
Hidg0: hidg0,
}
}
// io.writer probably isn't the best interface to use for this
func (k *Keyboard) Write(p []byte) (int, error) {
var (
index int
err error
)
for index < len(p) {
var (
r rune
s int
flag byte
report [8]byte
)
press:
for i := 2; i < 8 && index < len(p); i++ {
var (
mod byte
)
r, s = utf8.DecodeRune(p[index:])
if r == utf8.RuneError {
return index, fmt.Errorf("invalid rune: 0x%X", p[index]) // This probably screws things up if the last rune in 'p' is incomplete
}
cur, ok := k.CurrentKeymap()[string(r)]
if !ok {
if i == 2 { // We can change the keymap if we are on the first key
ok, err = k.changeKeymap(r)
if !ok { // rune does not have a mapping
if k.ErrOnUnknownKey {
if err != nil {
return index, err
}
return index, fmt.Errorf("rune not in keymap: %c", r)
}
index += s
break press
}
} else { // rune does not have a mapping in this keymaps
break press
}
}
switch {
case cur.PressDelayDelimiter:
var n int
n, k.PressDelay = parseDelay(p[index+s:])
index += s + n
break press
case cur.ReleaseDelayDelimiter:
var n int
n, k.ReleaseDelay = parseDelay(p[index+s:])
index += s + n
break press
case cur.Comment:
var n int
n = bytes.Index(p[index+s:], []byte("\n")) + 1
if n < 0 {
n = 0
}
index += s + n
break press
case r == '␀':
// Causes immediate key press useful for modifier keys
index += s
break press
default:
// Calculate next modifier byte
for _, v := range cur.Modifier {
mod |= k.flags[v]
}
// Set the modifier if it is the first key otherwise
// check if the next modifier byte is the same
if i == 2 {
flag = mod
} else if flag != mod {
// 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
}
// 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] && cur.Decimal != 0 {
break press
}
}
}
report[i] = cur.Decimal
index += s
if k.PressDelay > 0 {
// 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
}
}
}
report[0] = flag
err = k.Press(report, k.Hidg0)
if err != nil {
return index, err
}
k.delay(k.PressDelay)
}
err = k.keymapto0() // To make it reproducible
if err != nil {
return index, err
}
return index, nil
}
func parseDelay(buffer []byte) (count int, delay time.Duration) {
var index int
sb := strings.Builder{}
for index < len(buffer) {
r, s := utf8.DecodeRune(buffer[index:])
if unicode.IsDigit(r) {
sb.WriteRune(r)
index += s
} else {
if r == '\r' {
index += s
r, s = utf8.DecodeRune(buffer[index:])
}
if r == '\n' {
index += s
}
break
}
}
i, err := strconv.Atoi(sb.String())
if err == nil || err == strconv.ErrRange {
return index, time.Millisecond * time.Duration(i)
}
return 0, 0
}
func (k *Keyboard) delay(Delay time.Duration) {
if Delay > 0 {
if syncCheck, ok := k.Hidg0.(syncer); ok {
_ = syncCheck.Sync()
}
time.Sleep(Delay)
}
}
func (k *Keyboard) Press(press [8]byte, file io.Writer) error {
_, err1 := file.Write(press[:])
k.delay(k.ReleaseDelay)
_, err2 := file.Write([]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})
if err1 != nil {
return err1
}
if err2 != nil {
return err2
}
return nil
}
func (k *Keyboard) Hold(press [8]byte, file io.Writer) error {
_, err := file.Write(press[:])
return err
}
func (k *Keyboard) keymapto0() error {
if len(k.KeymapOrder) > 1 {
for i := 0; i < len(k.KeymapOrder)-(k.currentKeyMap); i++ {
err := k.Press(k.KeymapShortcut, k.Hidg0)
if err != nil {
return err
}
}
k.currentKeyMap = 0
}
return nil
}
func (k *Keyboard) changeKeymap(r rune) (bool, error) {
var err error
buf := bytes.NewBuffer(make([]byte, 0, 8*len(k.KeymapOrder))) // To batch shortcut presses
for i := 0; i < len(k.KeymapOrder); i++ {
_, ok := k.CurrentKeymap()[string(r)]
if ok {
_, err = k.Hidg0.Write(buf.Bytes())
return true, err
}
err = k.Press(k.KeymapShortcut, buf)
if err != nil {
return false, err
}
if k.currentKeyMap == len(k.KeymapOrder)-1 {
k.currentKeyMap = 0
} else {
k.currentKeyMap++
}
}
return false, nil
}
func (k *Keyboard) CurrentKeymap() Keymap {
keymap, ok := k.keymaps[k.KeymapOrder[k.currentKeyMap]]
if ok {
return keymap
}
if k.keymaps == nil {
k.keymaps = make(map[string]Keymap)
}
k.keymaps[k.KeymapOrder[k.currentKeyMap]] = LoadKeymap(k.KeymapOrder[k.currentKeyMap], k.KeymapPath)
return k.keymaps[k.KeymapOrder[k.currentKeyMap]]
}
func LoadKeymap(keymapName string, KeymapPath string) Keymap {
var (
err error
content []byte
file = path.Join(KeymapPath, keymapName+".json")
tmp = make(Keymap)
)
fmt.Println(file)
content, err = ioutil.ReadFile(file)
if err != nil {
return nil
}
err = json.Unmarshal(content, &tmp)
if err != nil {
return nil
}
return tmp
}

121
ghid/keys.go Normal file
View File

@ -0,0 +1,121 @@
package hid
var (
StandardKeys = map[string]byte{
"␀": 0x00,
"": 0x00,
"a": 0x04,
"A": 0x04,
"b": 0x05,
"B": 0x05,
"c": 0x06,
"C": 0x06,
"d": 0x07,
"D": 0x07,
"e": 0x08,
"E": 0x08,
"f": 0x09,
"F": 0x09,
"g": 0x0A,
"G": 0x0A,
"h": 0x0B,
"H": 0x0B,
"i": 0x0C,
"I": 0x0C,
"j": 0x0D,
"J": 0x0D,
"k": 0x0E,
"K": 0x0E,
"l": 0x0F,
"L": 0x0F,
"m": 0x10,
"M": 0x10,
"n": 0x11,
"N": 0x11,
"o": 0x12,
"O": 0x12,
"p": 0x13,
"P": 0x13,
"q": 0x14,
"Q": 0x14,
"r": 0x15,
"R": 0x15,
"s": 0x16,
"S": 0x16,
"t": 0x17,
"T": 0x17,
"u": 0x18,
"U": 0x18,
"v": 0x19,
"V": 0x19,
"w": 0x1A,
"W": 0x1A,
"x": 0x1B,
"X": 0x1B,
"y": 0x1C,
"Y": 0x1C,
"z": 0x1D,
"Z": 0x1D,
"!": 0x1E,
"1": 0x1E,
"2": 0x1F,
"@": 0x1F,
"#": 0x20,
"3": 0x20,
"$": 0x21,
"4": 0x21,
"%": 0x22,
"5": 0x22,
"6": 0x23,
"^": 0x23,
"&": 0x24,
"7": 0x24,
"*": 0x25,
"8": 0x25,
"(": 0x26,
"9": 0x26,
")": 0x27,
"0": 0x27,
"\n": 0x28,
"⎋": 0x29, // esc
"␛": 0x29, // esc
"⌫": 0x2A, // backspace
"\t": 0x2B,
" ": 0x2C,
"-": 0x2D,
"_": 0x2D,
"+": 0x2E,
"=": 0x2E,
"[": 0x2F,
"{": 0x2F,
"]": 0x30,
"}": 0x30,
"\\": 0x31,
"|": 0x31,
":": 0x33,
";": 0x33,
"'": 0x34,
"\"": 0x34,
"`": 0x35,
"~": 0x35,
",": 0x36,
"<": 0x36,
".": 0x37,
">": 0x37,
"/": 0x38,
"?": 0x38,
"⇪": 0x39,
"⎙": 0x46,
"⏸️": 0x48,
"⎀": 0x49,
"↖": 0x4A,
"⇞": 0x4B,
"⌦": 0x4C,
"↘": 0x4D,
"⇟": 0x4E,
"→": 0x4F,
"←": 0x50,
"↑": 0x51,
"↓": 0x52,
}
)

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module gitea.narnian.us/lordwelch/hid
go 1.18

495
keymaps/dvorak.json Normal file
View File

@ -0,0 +1,495 @@
{
"1": {
"modifier": ["NONE"],
"decimal": 30
},
"2": {
"modifier": ["NONE"],
"decimal": 31
},
"3": {
"modifier": ["NONE"],
"decimal": 32
},
"4": {
"modifier": ["NONE"],
"decimal": 33
},
"5": {
"modifier": ["NONE"],
"decimal": 34
},
"6": {
"modifier": ["NONE"],
"decimal": 35
},
"7": {
"modifier": ["NONE"],
"decimal": 36
},
"8": {
"modifier": ["NONE"],
"decimal": 37
},
"9": {
"modifier": ["NONE"],
"decimal": 38
},
"0": {
"modifier": ["NONE"],
"decimal": 39
},
"[": {
"modifier": ["NONE"],
"decimal": 45
},
"]": {
"modifier": ["NONE"],
"decimal": 46
},
"!": {
"modifier": ["LSHIFT"],
"decimal": 30
},
"@": {
"modifier": ["LSHIFT"],
"decimal": 31
},
"#": {
"modifier": ["LSHIFT"],
"decimal": 32
},
"$": {
"modifier": ["LSHIFT"],
"decimal": 33
},
"%": {
"modifier": ["LSHIFT"],
"decimal": 34
},
"^": {
"modifier": ["LSHIFT"],
"decimal": 35
},
"&": {
"modifier": ["LSHIFT"],
"decimal": 36
},
"*": {
"modifier": ["LSHIFT"],
"decimal": 37
},
"(": {
"modifier": ["LSHIFT"],
"decimal": 38
},
")": {
"modifier": ["LSHIFT"],
"decimal": 39
},
"{": {
"modifier": ["LSHIFT"],
"decimal": 45
},
"}": {
"modifier": ["LSHIFT"],
"decimal": 46
},
"'": {
"modifier": ["NONE"],
"decimal": 20
},
",": {
"modifier": ["NONE"],
"decimal": 26
},
".": {
"modifier": ["NONE"],
"decimal": 8
},
"p": {
"modifier": ["NONE"],
"decimal": 21
},
"y": {
"modifier": ["NONE"],
"decimal": 23
},
"f": {
"modifier": ["NONE"],
"decimal": 28
},
"g": {
"modifier": ["NONE"],
"decimal": 24
},
"c": {
"modifier": ["NONE"],
"decimal": 12
},
"r": {
"modifier": ["NONE"],
"decimal": 18
},
"l": {
"modifier": ["NONE"],
"decimal": 19
},
"/": {
"modifier": ["NONE"],
"decimal": 47
},
"=": {
"modifier": ["NONE"],
"decimal": 48
},
"\"": {
"modifier": ["LSHIFT"],
"decimal": 20
},
"<": {
"modifier": ["LSHIFT"],
"decimal": 26
},
">": {
"modifier": ["LSHIFT"],
"decimal": 8
},
"P": {
"modifier": ["LSHIFT"],
"decimal": 21
},
"Y": {
"modifier": ["LSHIFT"],
"decimal": 23
},
"F": {
"modifier": ["LSHIFT"],
"decimal": 28
},
"G": {
"modifier": ["LSHIFT"],
"decimal": 24
},
"C": {
"modifier": ["LSHIFT"],
"decimal": 12
},
"R": {
"modifier": ["LSHIFT"],
"decimal": 18
},
"L": {
"modifier": ["LSHIFT"],
"decimal": 19
},
"?": {
"modifier": ["LSHIFT"],
"decimal": 47
},
"+": {
"modifier": ["LSHIFT"],
"decimal": 48
},
"a": {
"modifier": ["NONE"],
"decimal": 4
},
"o": {
"modifier": ["NONE"],
"decimal": 22
},
"e": {
"modifier": ["NONE"],
"decimal": 7
},
"u": {
"modifier": ["NONE"],
"decimal": 9
},
"i": {
"modifier": ["NONE"],
"decimal": 10
},
"d": {
"modifier": ["NONE"],
"decimal": 11
},
"h": {
"modifier": ["NONE"],
"decimal": 13
},
"t": {
"modifier": ["NONE"],
"decimal": 14
},
"n": {
"modifier": ["NONE"],
"decimal": 15
},
"s": {
"modifier": ["NONE"],
"decimal": 51
},
"-": {
"modifier": ["NONE"],
"decimal": 52
},
"A": {
"modifier": ["LSHIFT"],
"decimal": 4
},
"O": {
"modifier": ["LSHIFT"],
"decimal": 22
},
"E": {
"modifier": ["LSHIFT"],
"decimal": 7
},
"U": {
"modifier": ["LSHIFT"],
"decimal": 9
},
"I": {
"modifier": ["LSHIFT"],
"decimal": 10
},
"D": {
"modifier": ["LSHIFT"],
"decimal": 11
},
"H": {
"modifier": ["LSHIFT"],
"decimal": 13
},
"T": {
"modifier": ["LSHIFT"],
"decimal": 14
},
"N": {
"modifier": ["LSHIFT"],
"decimal": 15
},
"S": {
"modifier": ["LSHIFT"],
"decimal": 51
},
"_": {
"modifier": ["LSHIFT"],
"decimal": 52
},
";": {
"modifier": ["NONE"],
"decimal": 29
},
"q": {
"modifier": ["NONE"],
"decimal": 27
},
"j": {
"modifier": ["NONE"],
"decimal": 6
},
"k": {
"modifier": ["NONE"],
"decimal": 25
},
"x": {
"modifier": ["NONE"],
"decimal": 5
},
"b": {
"modifier": ["NONE"],
"decimal": 17
},
"m": {
"modifier": ["NONE"],
"decimal": 16
},
"w": {
"modifier": ["NONE"],
"decimal": 54
},
"v": {
"modifier": ["NONE"],
"decimal": 55
},
"z": {
"modifier": ["NONE"],
"decimal": 56
},
":": {
"modifier": ["LSHIFT"],
"decimal": 29
},
"Q": {
"modifier": ["LSHIFT"],
"decimal": 27
},
"J": {
"modifier": ["LSHIFT"],
"decimal": 6
},
"K": {
"modifier": ["LSHIFT"],
"decimal": 25
},
"X": {
"modifier": ["LSHIFT"],
"decimal": 5
},
"B": {
"modifier": ["LSHIFT"],
"decimal": 17
},
"M": {
"modifier": ["LSHIFT"],
"decimal": 16
},
"W": {
"modifier": ["LSHIFT"],
"decimal": 54
},
"V": {
"modifier": ["LSHIFT"],
"decimal": 55
},
"Z": {
"modifier": ["LSHIFT"],
"decimal": 56
},
"\\": {
"modifier": ["NONE"],
"decimal": 49
},
"|": {
"modifier": ["LSHIFT"],
"decimal": 49
},
"`": {
"modifier": ["NONE"],
"decimal": 53
},
"~": {
"modifier": ["LSHIFT"],
"decimal": 53
},
"\t": {
"modifier": ["NONE"],
"decimal": 43
},
"\n": {
"modifier": ["NONE"],
"decimal": 40
},
" ": {
"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,
"PressDelayDelimiter": true
},
"🐉": {
"modifier": ["NONE"],
"decimal": 0,
"releaseDelayDelimiter": true
},
"⨌": {
"modifier": ["NONE"],
"decimal": 0,
"comment": true
}
}

500
keymaps/qwerty.json Normal file
View File

@ -0,0 +1,500 @@
{
"1": {
"modifier": ["NONE"],
"decimal": 30
},
"2": {
"modifier": ["NONE"],
"decimal": 31
},
"3": {
"modifier": ["NONE"],
"decimal": 32
},
"4": {
"modifier": ["NONE"],
"decimal": 33
},
"5": {
"modifier": ["NONE"],
"decimal": 34
},
"6": {
"modifier": ["NONE"],
"decimal": 35
},
"7": {
"modifier": ["NONE"],
"decimal": 36
},
"8": {
"modifier": ["NONE"],
"decimal": 37
},
"9": {
"modifier": ["NONE"],
"decimal": 38
},
"0": {
"modifier": ["NONE"],
"decimal": 39
},
"-": {
"modifier": ["NONE"],
"decimal": 45
},
"=": {
"modifier": ["NONE"],
"decimal": 46
},
"!": {
"modifier": ["LSHIFT"],
"decimal": 30
},
"@": {
"modifier": ["LSHIFT"],
"decimal": 31
},
"#": {
"modifier": ["LSHIFT"],
"decimal": 32
},
"$": {
"modifier": ["LSHIFT"],
"decimal": 33
},
"%": {
"modifier": ["LSHIFT"],
"decimal": 34
},
"^": {
"modifier": ["LSHIFT"],
"decimal": 35
},
"&": {
"modifier": ["LSHIFT"],
"decimal": 36
},
"*": {
"modifier": ["LSHIFT"],
"decimal": 37
},
"(": {
"modifier": ["LSHIFT"],
"decimal": 38
},
")": {
"modifier": ["LSHIFT"],
"decimal": 39
},
"_": {
"modifier": ["LSHIFT"],
"decimal": 45
},
"+": {
"modifier": ["LSHIFT"],
"decimal": 46
},
"q": {
"modifier": ["NONE"],
"decimal": 20
},
"w": {
"modifier": ["NONE"],
"decimal": 26
},
"e": {
"modifier": ["NONE"],
"decimal": 8
},
"r": {
"modifier": ["NONE"],
"decimal": 21
},
"t": {
"modifier": ["NONE"],
"decimal": 23
},
"y": {
"modifier": ["NONE"],
"decimal": 28
},
"u": {
"modifier": ["NONE"],
"decimal": 24
},
"i": {
"modifier": ["NONE"],
"decimal": 12
},
"o": {
"modifier": ["NONE"],
"decimal": 18
},
"p": {
"modifier": ["NONE"],
"decimal": 19
},
"[": {
"modifier": ["NONE"],
"decimal": 47
},
"]": {
"modifier": ["NONE"],
"decimal": 48
},
"Q": {
"modifier": ["LSHIFT"],
"decimal": 20
},
"W": {
"modifier": ["LSHIFT"],
"decimal": 26
},
"E": {
"modifier": ["LSHIFT"],
"decimal": 8
},
"R": {
"modifier": ["LSHIFT"],
"decimal": 21
},
"T": {
"modifier": ["LSHIFT"],
"decimal": 23
},
"Y": {
"modifier": ["LSHIFT"],
"decimal": 28
},
"U": {
"modifier": ["LSHIFT"],
"decimal": 24
},
"I": {
"modifier": ["LSHIFT"],
"decimal": 12
},
"O": {
"modifier": ["LSHIFT"],
"decimal": 18
},
"P": {
"modifier": ["LSHIFT"],
"decimal": 19
},
"{": {
"modifier": ["LSHIFT"],
"decimal": 47
},
"}": {
"modifier": ["LSHIFT"],
"decimal": 48
},
"a": {
"modifier": ["NONE"],
"decimal": 4
},
"s": {
"modifier": ["NONE"],
"decimal": 22
},
"d": {
"modifier": ["NONE"],
"decimal": 7
},
"f": {
"modifier": ["NONE"],
"decimal": 9
},
"g": {
"modifier": ["NONE"],
"decimal": 10
},
"h": {
"modifier": ["NONE"],
"decimal": 11
},
"j": {
"modifier": ["NONE"],
"decimal": 13
},
"k": {
"modifier": ["NONE"],
"decimal": 14
},
"l": {
"modifier": ["NONE"],
"decimal": 15
},
";": {
"modifier": ["NONE"],
"decimal": 51
},
"'": {
"modifier": ["NONE"],
"decimal": 52
},
"A": {
"modifier": ["LSHIFT"],
"decimal": 4
},
"S": {
"modifier": ["LSHIFT"],
"decimal": 22
},
"D": {
"modifier": ["LSHIFT"],
"decimal": 7
},
"F": {
"modifier": ["LSHIFT"],
"decimal": 9
},
"G": {
"modifier": ["LSHIFT"],
"decimal": 10
},
"H": {
"modifier": ["LSHIFT"],
"decimal": 11
},
"J": {
"modifier": ["LSHIFT"],
"decimal": 13
},
"K": {
"modifier": ["LSHIFT"],
"decimal": 14
},
"L": {
"modifier": ["LSHIFT"],
"decimal": 15
},
":": {
"modifier": ["LSHIFT"],
"decimal": 51
},
"\"": {
"modifier": ["LSHIFT"],
"decimal": 52
},
"z": {
"modifier": ["NONE"],
"decimal": 29
},
"x": {
"modifier": ["NONE"],
"decimal": 27
},
"c": {
"modifier": ["NONE"],
"decimal": 6
},
"v": {
"modifier": ["NONE"],
"decimal": 25
},
"b": {
"modifier": ["NONE"],
"decimal": 5
},
"n": {
"modifier": ["NONE"],
"decimal": 17
},
"m": {
"modifier": ["NONE"],
"decimal": 16
},
",": {
"modifier": ["NONE"],
"decimal": 54
},
".": {
"modifier": ["NONE"],
"decimal": 55
},
"/": {
"modifier": ["NONE"],
"decimal": 56
},
"Z": {
"modifier": ["LSHIFT"],
"decimal": 29
},
"X": {
"modifier": ["LSHIFT"],
"decimal": 27
},
"C": {
"modifier": ["LSHIFT"],
"decimal": 6
},
"V": {
"modifier": ["LSHIFT"],
"decimal": 25
},
"B": {
"modifier": ["LSHIFT"],
"decimal": 5
},
"N": {
"modifier": ["LSHIFT"],
"decimal": 17
},
"M": {
"modifier": ["LSHIFT"],
"decimal": 16
},
"<": {
"modifier": ["LSHIFT"],
"decimal": 54
},
">": {
"modifier": ["LSHIFT"],
"decimal": 55
},
"?": {
"modifier": ["LSHIFT"],
"decimal": 56
},
"\\": {
"modifier": ["NONE"],
"decimal": 49
},
"|": {
"modifier": ["LSHIFT"],
"decimal": 49
},
"`": {
"modifier": ["NONE"],
"decimal": 53
},
"~": {
"modifier": ["LSHIFT"],
"decimal": 53
},
"\t": {
"modifier": ["NONE"],
"decimal": 43
},
"\n": {
"modifier": ["NONE"],
"decimal": 40
},
" ": {
"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,
"PressDelayDelimiter": true
},
"🐉": {
"modifier": ["NONE"],
"decimal": 0,
"releaseDelayDelimiter": true
},
"⨌": {
"modifier": ["NONE"],
"decimal": 0,
"comment": true
}
}

495
keymaps/tengwar-f.json Normal file
View File

@ -0,0 +1,495 @@
{
"": {
"modifier": ["NONE"],
"decimal": 30
},
"": {
"modifier": ["NONE"],
"decimal": 31
},
"": {
"modifier": ["NONE"],
"decimal": 32
},
"": {
"modifier": ["NONE"],
"decimal": 33
},
"": {
"modifier": ["NONE"],
"decimal": 34
},
"": {
"modifier": ["NONE"],
"decimal": 35
},
"": {
"modifier": ["NONE"],
"decimal": 36
},
"": {
"modifier": ["NONE"],
"decimal": 37
},
"": {
"modifier": ["NONE"],
"decimal": 38
},
"": {
"modifier": ["NONE"],
"decimal": 39
},
"": {
"modifier": ["NONE"],
"decimal": 45
},
"": {
"modifier": ["NONE"],
"decimal": 46
},
"": {
"modifier": ["LSHIFT"],
"decimal": 30
},
"": {
"modifier": ["LSHIFT"],
"decimal": 31
},
"": {
"modifier": ["LSHIFT"],
"decimal": 32
},
"": {
"modifier": ["LSHIFT"],
"decimal": 33
},
"": {
"modifier": ["LSHIFT"],
"decimal": 34
},
"": {
"modifier": ["LSHIFT"],
"decimal": 35
},
"": {
"modifier": ["LSHIFT"],
"decimal": 36
},
"": {
"modifier": ["LSHIFT"],
"decimal": 37
},
"": {
"modifier": ["LSHIFT"],
"decimal": 38
},
"": {
"modifier": ["LSHIFT"],
"decimal": 39
},
"": {
"modifier": ["LSHIFT"],
"decimal": 45
},
"": {
"modifier": ["LSHIFT"],
"decimal": 46
},
"": {
"modifier": ["NONE"],
"decimal": 20
},
"": {
"modifier": ["NONE"],
"decimal": 26
},
"": {
"modifier": ["NONE"],
"decimal": 8
},
"": {
"modifier": ["NONE"],
"decimal": 21
},
"": {
"modifier": ["NONE"],
"decimal": 23
},
"": {
"modifier": ["NONE"],
"decimal": 28
},
"": {
"modifier": ["NONE"],
"decimal": 24
},
"": {
"modifier": ["NONE"],
"decimal": 12
},
"": {
"modifier": ["NONE"],
"decimal": 18
},
"": {
"modifier": ["NONE"],
"decimal": 19
},
"": {
"modifier": ["NONE"],
"decimal": 47
},
"": {
"modifier": ["NONE"],
"decimal": 48
},
"": {
"modifier": ["LSHIFT"],
"decimal": 20
},
"": {
"modifier": ["LSHIFT"],
"decimal": 26
},
"": {
"modifier": ["LSHIFT"],
"decimal": 8
},
"": {
"modifier": ["LSHIFT"],
"decimal": 21
},
"": {
"modifier": ["LSHIFT"],
"decimal": 23
},
"": {
"modifier": ["LSHIFT"],
"decimal": 28
},
"": {
"modifier": ["LSHIFT"],
"decimal": 24
},
"": {
"modifier": ["LSHIFT"],
"decimal": 12
},
"": {
"modifier": ["LSHIFT"],
"decimal": 18
},
"": {
"modifier": ["LSHIFT"],
"decimal": 19
},
"": {
"modifier": ["LSHIFT"],
"decimal": 47
},
"": {
"modifier": ["LSHIFT"],
"decimal": 48
},
"": {
"modifier": ["NONE"],
"decimal": 4
},
"": {
"modifier": ["NONE"],
"decimal": 22
},
"": {
"modifier": ["NONE"],
"decimal": 7
},
"": {
"modifier": ["NONE"],
"decimal": 9
},
"": {
"modifier": ["NONE"],
"decimal": 10
},
"": {
"modifier": ["NONE"],
"decimal": 11
},
"": {
"modifier": ["NONE"],
"decimal": 13
},
"": {
"modifier": ["NONE"],
"decimal": 14
},
"": {
"modifier": ["NONE"],
"decimal": 15
},
"": {
"modifier": ["NONE"],
"decimal": 51
},
"": {
"modifier": ["NONE"],
"decimal": 52
},
"": {
"modifier": ["LSHIFT"],
"decimal": 4
},
"": {
"modifier": ["LSHIFT"],
"decimal": 22
},
"": {
"modifier": ["LSHIFT"],
"decimal": 7
},
"": {
"modifier": ["LSHIFT"],
"decimal": 9
},
"": {
"modifier": ["LSHIFT"],
"decimal": 10
},
"": {
"modifier": ["LSHIFT"],
"decimal": 11
},
"": {
"modifier": ["LSHIFT"],
"decimal": 13
},
"": {
"modifier": ["LSHIFT"],
"decimal": 14
},
"": {
"modifier": ["LSHIFT"],
"decimal": 15
},
"": {
"modifier": ["LSHIFT"],
"decimal": 51
},
"": {
"modifier": ["LSHIFT"],
"decimal": 52
},
"": {
"modifier": ["NONE"],
"decimal": 29
},
"": {
"modifier": ["NONE"],
"decimal": 27
},
"": {
"modifier": ["NONE"],
"decimal": 6
},
"": {
"modifier": ["NONE"],
"decimal": 25
},
"": {
"modifier": ["NONE"],
"decimal": 5
},
"": {
"modifier": ["NONE"],
"decimal": 17
},
"": {
"modifier": ["NONE"],
"decimal": 16
},
"": {
"modifier": ["NONE"],
"decimal": 54
},
"": {
"modifier": ["NONE"],
"decimal": 55
},
"": {
"modifier": ["NONE"],
"decimal": 56
},
"": {
"modifier": ["LSHIFT"],
"decimal": 29
},
"": {
"modifier": ["LSHIFT"],
"decimal": 27
},
"": {
"modifier": ["LSHIFT"],
"decimal": 6
},
"": {
"modifier": ["LSHIFT"],
"decimal": 25
},
"": {
"modifier": ["LSHIFT"],
"decimal": 5
},
"": {
"modifier": ["LSHIFT"],
"decimal": 17
},
"": {
"modifier": ["LSHIFT"],
"decimal": 16
},
"W": {
"modifier": ["LSHIFT"],
"decimal": 54
},
"": {
"modifier": ["LSHIFT"],
"decimal": 55
},
"": {
"modifier": ["LSHIFT"],
"decimal": 56
},
"": {
"modifier": ["NONE"],
"decimal": 49
},
"": {
"modifier": ["LSHIFT"],
"decimal": 49
},
"\\": {
"modifier": ["NONE"],
"decimal": 53
},
"|": {
"modifier": ["LSHIFT"],
"decimal": 53
},
"\t": {
"modifier": ["NONE"],
"decimal": 43
},
"\n": {
"modifier": ["NONE"],
"decimal": 40
},
" ": {
"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,
"PressDelayDelimiter": true
},
"🐉": {
"modifier": ["NONE"],
"decimal": 0,
"releaseDelayDelimiter": true
},
"⨌": {
"modifier": ["NONE"],
"decimal": 0,
"comment": true
}
}

483
keymaps/tengwar-u.json Normal file
View File

@ -0,0 +1,483 @@
{
"": {
"modifier": ["NONE"],
"decimal": 30
},
"": {
"modifier": ["NONE"],
"decimal": 31
},
"": {
"modifier": ["NONE"],
"decimal": 32
},
"": {
"modifier": ["NONE"],
"decimal": 33
},
"": {
"modifier": ["NONE"],
"decimal": 34
},
"": {
"modifier": ["NONE"],
"decimal": 35
},
"": {
"modifier": ["NONE"],
"decimal": 36
},
"": {
"modifier": ["NONE"],
"decimal": 37
},
"": {
"modifier": ["NONE"],
"decimal": 38
},
"": {
"modifier": ["NONE"],
"decimal": 39
},
"": {
"modifier": ["NONE"],
"decimal": 45
},
"": {
"modifier": ["NONE"],
"decimal": 46
},
"": {
"modifier": ["LSHIFT"],
"decimal": 30
},
"": {
"modifier": ["RALT"],
"decimal": 31
},
"": {
"modifier": ["LSHIFT"],
"decimal": 32
},
"": {
"modifier": ["LSHIFT"],
"decimal": 35
},
"⁊": {
"modifier": ["LSHIFT"],
"decimal": 36
},
"⸭": {
"modifier": ["LSHIFT"],
"decimal": 37
},
"": {
"modifier": ["LSHIFT"],
"decimal": 38
},
"": {
"modifier": ["LSHIFT"],
"decimal": 39
},
"": {
"modifier": ["LSHIFT"],
"decimal": 45
},
"": {
"modifier": ["LSHIFT"],
"decimal": 46
},
"": {
"modifier": ["NONE"],
"decimal": 20
},
"": {
"modifier": ["NONE"],
"decimal": 26
},
"": {
"modifier": ["NONE"],
"decimal": 8
},
"": {
"modifier": ["NONE"],
"decimal": 21
},
"": {
"modifier": ["NONE"],
"decimal": 23
},
"": {
"modifier": ["NONE"],
"decimal": 28
},
"": {
"modifier": ["NONE"],
"decimal": 24
},
"": {
"modifier": ["NONE"],
"decimal": 12
},
"": {
"modifier": ["NONE"],
"decimal": 18
},
"": {
"modifier": ["NONE"],
"decimal": 19
},
"": {
"modifier": ["NONE"],
"decimal": 47
},
"": {
"modifier": ["NONE"],
"decimal": 48
},
"": {
"modifier": ["LSHIFT"],
"decimal": 20
},
"": {
"modifier": ["LSHIFT"],
"decimal": 26
},
"": {
"modifier": ["LSHIFT"],
"decimal": 8
},
"": {
"modifier": ["LSHIFT"],
"decimal": 21
},
"": {
"modifier": ["LSHIFT"],
"decimal": 23
},
"": {
"modifier": ["LSHIFT"],
"decimal": 28
},
"": {
"modifier": ["LSHIFT"],
"decimal": 24
},
"": {
"modifier": ["LSHIFT"],
"decimal": 12
},
"": {
"modifier": ["LSHIFT"],
"decimal": 18
},
"": {
"modifier": ["LSHIFT"],
"decimal": 19
},
"“": {
"modifier": ["RALT"],
"decimal": 47
},
"": {
"modifier": ["RALT"],
"decimal": 48
},
"": {
"modifier": ["NONE"],
"decimal": 4
},
"": {
"modifier": ["NONE"],
"decimal": 22
},
"": {
"modifier": ["NONE"],
"decimal": 7
},
"": {
"modifier": ["NONE"],
"decimal": 9
},
"": {
"modifier": ["NONE"],
"decimal": 10
},
"": {
"modifier": ["NONE"],
"decimal": 11
},
"": {
"modifier": ["NONE"],
"decimal": 13
},
"": {
"modifier": ["NONE"],
"decimal": 14
},
"": {
"modifier": ["NONE"],
"decimal": 15
},
"჻": {
"modifier": ["NONE"],
"decimal": 51
},
"": {
"modifier": ["NONE"],
"decimal": 52
},
"": {
"modifier": ["LSHIFT"],
"decimal": 4
},
"": {
"modifier": ["LSHIFT"],
"decimal": 22
},
"": {
"modifier": ["LSHIFT"],
"decimal": 7
},
"": {
"modifier": ["LSHIFT"],
"decimal": 9
},
"": {
"modifier": ["LSHIFT"],
"decimal": 10
},
"": {
"modifier": ["LSHIFT"],
"decimal": 11
},
"": {
"modifier": ["LSHIFT"],
"decimal": 13
},
"": {
"modifier": ["LSHIFT"],
"decimal": 14
},
"": {
"modifier": ["LSHIFT"],
"decimal": 15
},
"⁝": {
"modifier": ["LSHIFT"],
"decimal": 51
},
"": {
"modifier": ["RALT"],
"decimal": 52
},
"": {
"modifier": ["NONE"],
"decimal": 29
},
"": {
"modifier": ["NONE"],
"decimal": 27
},
"": {
"modifier": ["NONE"],
"decimal": 6
},
"": {
"modifier": ["NONE"],
"decimal": 25
},
"": {
"modifier": ["NONE"],
"decimal": 5
},
"": {
"modifier": ["NONE"],
"decimal": 17
},
"": {
"modifier": ["NONE"],
"decimal": 16
},
"⸱": {
"modifier": ["NONE"],
"decimal": 54
},
"⁘": {
"modifier": ["NONE"],
"decimal": 55
},
"": {
"modifier": ["NONE"],
"decimal": 56
},
"": {
"modifier": ["LSHIFT"],
"decimal": 29
},
"": {
"modifier": ["LSHIFT"],
"decimal": 27
},
"": {
"modifier": ["LSHIFT"],
"decimal": 6
},
"": {
"modifier": ["LSHIFT"],
"decimal": 25
},
"": {
"modifier": ["LSHIFT"],
"decimal": 5
},
"": {
"modifier": ["LSHIFT"],
"decimal": 17
},
"": {
"modifier": ["LSHIFT"],
"decimal": 16
},
":": {
"modifier": ["LSHIFT"],
"decimal": 54
},
"⸬": {
"modifier": ["LSHIFT"],
"decimal": 55
},
"": {
"modifier": ["LSHIFT"],
"decimal": 56
},
"": {
"modifier": ["NONE"],
"decimal": 49
},
"": {
"modifier": ["LSHIFT"],
"decimal": 49
},
"": {
"modifier": ["NONE"],
"decimal": 53
},
"\t": {
"modifier": ["NONE"],
"decimal": 43
},
"\n": {
"modifier": ["NONE"],
"decimal": 40
},
" ": {
"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,
"PressDelayDelimiter": true
},
"🐉": {
"modifier": ["NONE"],
"decimal": 0,
"releaseDelayDelimiter": true
},
"⨌": {
"modifier": ["NONE"],
"decimal": 0,
"comment": true
}
}

667
keymaps/tiro.json Normal file
View File

@ -0,0 +1,667 @@
{
"1": {
"modifier": ["NONE"],
"decimal": 30
},
"2": {
"modifier": ["NONE"],
"decimal": 31
},
"3": {
"modifier": ["NONE"],
"decimal": 32
},
"4": {
"modifier": ["NONE"],
"decimal": 33
},
"5": {
"modifier": ["NONE"],
"decimal": 34
},
"6": {
"modifier": ["NONE"],
"decimal": 35
},
"7": {
"modifier": ["NONE"],
"decimal": 36
},
"8": {
"modifier": ["NONE"],
"decimal": 37
},
"9": {
"modifier": ["NONE"],
"decimal": 38
},
"0": {
"modifier": ["NONE"],
"decimal": 39
},
"־": {
"modifier": ["NONE"],
"decimal": 45
},
"֩": {
"modifier": ["LSHIFT"],
"decimal": 30
},
"֙": {
"modifier": ["LSHIFT"],
"decimal": 31
},
"֒": {
"modifier": ["LSHIFT"],
"decimal": 32
},
"֯": {
"modifier": ["LSHIFT"],
"decimal": 33
},
"ֺ": {
"modifier": ["LSHIFT"],
"decimal": 34
},
"ֹ": {
"modifier": ["LSHIFT"],
"decimal": 35
},
"ֿ": {
"modifier": ["LSHIFT"],
"decimal": 36
},
"ׂ": {
"modifier": ["LSHIFT"],
"decimal": 37
},
"ׁ": {
"modifier": ["LSHIFT"],
"decimal": 38
},
"֝": {
"modifier": ["LSHIFT"],
"decimal": 39
},
"֠": {
"modifier": ["LSHIFT"],
"decimal": 45
},
"ּ": {
"modifier": ["LSHIFT"],
"decimal": 46
},
"₪": {
"modifier": ["RALT"],
"decimal": 33
},
"": {
"modifier": ["RALT"],
"decimal": 34
},
"": {
"modifier": ["RALT"],
"decimal": 35
},
"͏": {
"modifier": ["RALT"],
"decimal": 36
},
"": {
"modifier": ["RALT"],
"decimal": 37
},
"": {
"modifier": ["RALT"],
"decimal": 38
},
"◌": {
"modifier": ["RALT"],
"decimal": 39
},
"-": {
"modifier": ["RALT"],
"decimal": 45
},
"1": {
"modifier": ["RALT","LSHIFT"],
"decimal": 30
},
"2": {
"modifier": ["RALT","LSHIFT"],
"decimal": 31
},
"3": {
"modifier": ["RALT","LSHIFT"],
"decimal": 32
},
"4": {
"modifier": ["RALT","LSHIFT"],
"decimal": 33
},
"5": {
"modifier": ["RALT","LSHIFT"],
"decimal": 34
},
"6": {
"modifier": ["RALT","LSHIFT"],
"decimal": 35
},
"7": {
"modifier": ["RALT","LSHIFT"],
"decimal": 36
},
"8": {
"modifier": ["RALT","LSHIFT"],
"decimal": 37
},
"9": {
"modifier": ["RALT","LSHIFT"],
"decimal": 38
},
"0": {
"modifier": ["RALT","LSHIFT"],
"decimal": 39
},
"_": {
"modifier": ["RALT","LSHIFT"],
"decimal": 45
},
"+": {
"modifier": ["RALT","LSHIFT"],
"decimal": 46
},
"̇": {
"modifier": ["NONE"],
"decimal": 20
},
"׳": {
"modifier": ["NONE"],
"decimal": 26
},
"ק": {
"modifier": ["NONE"],
"decimal": 8
},
"ר": {
"modifier": ["NONE"],
"decimal": 21
},
"א": {
"modifier": ["NONE"],
"decimal": 23
},
"ט": {
"modifier": ["NONE"],
"decimal": 28
},
"ו": {
"modifier": ["NONE"],
"decimal": 24
},
"ן": {
"modifier": ["NONE"],
"decimal": 12
},
"ם": {
"modifier": ["NONE"],
"decimal": 18
},
"פ": {
"modifier": ["NONE"],
"decimal": 19
},
"]": {
"modifier": ["NONE"],
"decimal": 47
},
"[": {
"modifier": ["NONE"],
"decimal": 48
},
"ׄ": {
"modifier": ["LSHIFT"],
"decimal": 20
},
"֬": {
"modifier": ["LSHIFT"],
"decimal": 26
},
"֫": {
"modifier": ["LSHIFT"],
"decimal": 8
},
"֟": {
"modifier": ["LSHIFT"],
"decimal": 21
},
"֓": {
"modifier": ["LSHIFT"],
"decimal": 23
},
"֞": {
"modifier": ["LSHIFT"],
"decimal": 28
},
"֜": {
"modifier": ["LSHIFT"],
"decimal": 24
},
"֡": {
"modifier": ["LSHIFT"],
"decimal": 12
},
"֕": {
"modifier": ["LSHIFT"],
"decimal": 18
},
"֔": {
"modifier": ["LSHIFT"],
"decimal": 19
},
"֗": {
"modifier": ["LSHIFT"],
"decimal": 47
},
"֘": {
"modifier": ["LSHIFT"],
"decimal": 48
},
"̈": {
"modifier": ["RALT"],
"decimal": 20
},
"״": {
"modifier": ["RALT"],
"decimal": 26
},
"€": {
"modifier": ["RALT"],
"decimal": 8
},
"װ": {
"modifier": ["RALT"],
"decimal": 24
},
"ש": {
"modifier": ["NONE"],
"decimal": 4
},
"/": {
"modifier": ["RALT","LSHIFT"],
"decimal": 20
},
"'": {
"modifier": ["RALT","LSHIFT"],
"decimal": 26
},
"}": {
"modifier": ["RALT","LSHIFT"],
"decimal": 47
},
"{": {
"modifier": ["RALT","LSHIFT"],
"decimal": 48
},
"ד": {
"modifier": ["NONE"],
"decimal": 22
},
"ג": {
"modifier": ["NONE"],
"decimal": 7
},
"כ": {
"modifier": ["NONE"],
"decimal": 9
},
"ע": {
"modifier": ["NONE"],
"decimal": 10
},
"י": {
"modifier": ["NONE"],
"decimal": 11
},
"ח": {
"modifier": ["NONE"],
"decimal": 13
},
"ל": {
"modifier": ["NONE"],
"decimal": 14
},
"ך": {
"modifier": ["NONE"],
"decimal": 15
},
"ף": {
"modifier": ["NONE"],
"decimal": 51
},
"֚": {
"modifier": ["NONE"],
"decimal": 52
},
"ֽ": {
"modifier": ["LSHIFT"],
"decimal": 4
},
"ְ": {
"modifier": ["LSHIFT"],
"decimal": 22
},
"ֻ": {
"modifier": ["LSHIFT"],
"decimal": 7
},
"ִ": {
"modifier": ["LSHIFT"],
"decimal": 9
},
"ֱ": {
"modifier": ["LSHIFT"],
"decimal": 10
},
"ֶ": {
"modifier": ["LSHIFT"],
"decimal": 11
},
"ֵ": {
"modifier": ["LSHIFT"],
"decimal": 13
},
"ֳ": {
"modifier": ["LSHIFT"],
"decimal": 14
},
"ָ": {
"modifier": ["LSHIFT"],
"decimal": 15
},
"ֲ": {
"modifier": ["LSHIFT"],
"decimal": 51
},
"ַ": {
"modifier": ["LSHIFT"],
"decimal": 52
},
"ײ": {
"modifier": ["RALT"],
"decimal": 11
},
"ױ": {
"modifier": ["RALT"],
"decimal": 13
},
"ׇ": {
"modifier": ["RALT"],
"decimal": 15
},
",": {
"modifier": ["RALT"],
"decimal": 52
},
":": {
"modifier": ["RALT","LSHIFT"],
"decimal": 51
},
"\"": {
"modifier": ["RALT","LSHIFT"],
"decimal": 52
},
"ז": {
"modifier": ["NONE"],
"decimal": 29
},
"ס": {
"modifier": ["NONE"],
"decimal": 27
},
"ב": {
"modifier": ["NONE"],
"decimal": 6
},
"ה": {
"modifier": ["NONE"],
"decimal": 25
},
"נ": {
"modifier": ["NONE"],
"decimal": 5
},
"מ": {
"modifier": ["NONE"],
"decimal": 17
},
"צ": {
"modifier": ["NONE"],
"decimal": 16
},
"ת": {
"modifier": ["NONE"],
"decimal": 54
},
"ץ": {
"modifier": ["NONE"],
"decimal": 55
},
"֭": {
"modifier": ["NONE"],
"decimal": 56
},
"ׅ": {
"modifier": ["LSHIFT"],
"decimal": 29
},
"֤": {
"modifier": ["LSHIFT"],
"decimal": 27
},
"֪": {
"modifier": ["LSHIFT"],
"decimal": 6
},
"֦": {
"modifier": ["LSHIFT"],
"decimal": 25
},
"֥": {
"modifier": ["LSHIFT"],
"decimal": 5
},
"֧": {
"modifier": ["LSHIFT"],
"decimal": 17
},
"֛": {
"modifier": ["LSHIFT"],
"decimal": 16
},
"֑": {
"modifier": ["LSHIFT"],
"decimal": 54
},
"֖": {
"modifier": ["LSHIFT"],
"decimal": 55
},
"֣": {
"modifier": ["LSHIFT"],
"decimal": 56
},
"֢": {
"modifier": ["RALT"],
"decimal": 6
},
"׆": {
"modifier": ["RALT"],
"decimal": 5
},
".": {
"modifier": ["RALT"],
"decimal": 56
},
">": {
"modifier": ["RALT","LSHIFT"],
"decimal": 54
},
"<": {
"modifier": ["RALT","LSHIFT"],
"decimal": 55
},
"?": {
"modifier": ["RALT","LSHIFT"],
"decimal": 56
},
"׀": {
"modifier": ["NONE"],
"decimal": 49
},
"֨": {
"modifier": ["LSHIFT"],
"decimal": 49
},
"\\": {
"modifier": ["RALT"],
"decimal": 49
},
"|": {
"modifier": ["RALT"],
"decimal": 49
},
"׃": {
"modifier": ["NONE"],
"decimal": 53
},
"֮": {
"modifier": ["LSHIFT"],
"decimal": 53
},
";": {
"modifier": ["RALT"],
"decimal": 53
},
"~": {
"modifier": ["RALT","LSHIFT"],
"decimal": 53
},
"\t": {
"modifier": ["NONE"],
"decimal": 43
},
"\n": {
"modifier": ["NONE"],
"decimal": 40
},
" ": {
"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,
"PressDelayDelimiter": true
},
"🐉": {
"modifier": ["NONE"],
"decimal": 0,
"releaseDelayDelimiter": true
},
"⨌": {
"modifier": ["NONE"],
"decimal": 0,
"comment": true
}
}

221
main.go
View File

@ -1,147 +1,132 @@
package main
import (
"bufio"
"encoding/binary"
"encoding/json"
"flag"
"fmt"
"io"
"io/ioutil"
"os"
"path"
"strings"
"time"
"github.com/alexflint/go-arg"
hid "gitea.narnian.us/lordwelch/hid/ghid"
)
type Key struct {
Modifier string `json:"modifier"`
Decimal int `json:"decimal"`
}
type Keys map[string]Key
type Args struct {
SHORTCUT string `arg:"-S,help:Keymap cycle shortcut"`
ORDER []string `arg:"positional,help:Order of keymaps"`
}
const (
LCTRL byte = 1 << iota
LSHIFT
LALT
LSUPER
RCTRL
RSHIFT
RALT
RSUPER
)
func Press(press [8]byte, file io.Writer) {
binary.Write(file, binary.BigEndian, press[:])
binary.Write(file, binary.BigEndian, [8]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})
fmt.Println(press)
fmt.Println([8]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})
}
func Hold(press [8]byte, file io.Writer) {
binary.Write(file, binary.BigEndian, press[:])
}
func changeKeymap(r rune, keys map[string]Keys, args Args, hidg0 *os.File, currentKeyMap *int) {
fmt.Println(*currentKeyMap)
fmt.Println(args)
kmap := args.ORDER[(*currentKeyMap)]
fmt.Println(kmap)
for keys[kmap][string(r)].Decimal == 0 {
Press([8]byte{LCTRL, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00}, hidg0)
*currentKeyMap++
if *currentKeyMap == len(keys) {
panic("key not in keymap")
func contains(str string, find []string) bool {
str = strings.ToLower(str)
for _, s := range find {
if strings.Contains(str, strings.ToLower(s)) {
return true
}
}
return false
}
func parse_shortcut(shortcut string) ([8]byte, error) {
var (
modifiers = []string{}
key = ""
curModifier byte = 0
curKey byte = 0
)
strs := strings.SplitN(strings.ToLower(shortcut), " ", 2)
if len(strs) > 1 {
modifiers = strings.Split(strs[0], "|")
key = strings.TrimSpace(strs[1])
} else {
if contains(strs[0], hid.AllModifiers) {
modifiers = strings.Split(strs[0], "|")
} else {
key = strings.TrimSpace(strs[0])
}
}
for _, v := range modifiers {
curModifier |= hid.Modifiers[strings.TrimSpace(v)]
}
if id, ok := hid.StandardKeys[key]; ok {
curKey = id
} else {
return [8]byte{}, fmt.Errorf("Key %q not found", key)
}
return [8]byte{curModifier, 0x0, curKey}, nil
}
func main() {
var (
args Args
hidg0 *os.File
err error
keymapsF []os.FileInfo
keys = make(map[string]Keys)
cfgPath = "./" //path.Join(os.Getenv("XDG_CONFIG_HOME"), "hid")
stdin = bufio.NewReader(os.Stdin)
currentKeyMap int
Shortcut string
filePath string
keymapPath string
ghidPath string
pressDelay time.Duration
releaseDelay time.Duration
err error
ghid *os.File
tmp *os.File
keyboard *hid.Keyboard
keymaps []string
)
arg.MustParse(&args)
keymapsF, err = ioutil.ReadDir(cfgPath)
if err != nil {
panic(err)
if _, exists := os.LookupEnv("XDG_CONFIG_HOME"); !exists {
_ = os.Setenv("XDG_CONFIG_HOME", path.Join(os.ExpandEnv("$HOME"), ".config"))
}
fmt.Println(cfgPath)
fmt.Println(keymapsF)
hidg0, err = os.OpenFile("/dev/hidg0", os.O_WRONLY, os.ModePerm)
flag.StringVar(&Shortcut, "shortcut", "", "Keymap cycle shortcut")
flag.StringVar(&Shortcut, "s", "LALT ⇪", "Keymap cycle shortcut")
flag.StringVar(&keymapPath, "path", path.Join(os.ExpandEnv("$XDG_CONFIG_HOME"), "hid"), "Path to config dir default: $XDG_CONFIG_HOME")
flag.StringVar(&keymapPath, "p", path.Join(os.ExpandEnv("$XDG_CONFIG_HOME"), "hid"), "Path to config dir default: $XDG_CONFIG_HOME")
flag.StringVar(&filePath, "f", "-", "The file to read content from. Defaults to stdin")
flag.StringVar(&filePath, "file", "-", "The file to read content from. Defaults to stdin")
flag.StringVar(&ghidPath, "g", "/dev/hidg0", "The device to send key presses to. Defaults to /dev/hidg0")
flag.StringVar(&ghidPath, "ghid", "/dev/hidg0", "The device to send key presses to. Defaults to /dev/hidg0")
flag.DurationVar(&pressDelay, "press", 0, "sets the default delay between presses of individual keys")
flag.DurationVar(&releaseDelay, "release", 0, "sets the default delay between sending the press of an individual key and sending the release")
flag.Parse()
if flag.NArg() < 0 {
flag.Usage()
os.Exit(1)
}
fmt.Println(keymapPath)
dirs, err := os.ReadDir(keymapPath)
if err != nil {
panic(err)
}
for _, file := range keymapsF {
var (
ext string
)
ext = path.Ext(file.Name())
fmt.Println(ext)
if strings.ToLower(ext) == ".json" {
var (
tmp Keys
T *os.File
content []byte
)
fmt.Println(file.Name())
T, err = os.Open(file.Name())
if err != nil {
panic(err)
keymap:
for _, requestedKeymap := range flag.Args() {
for _, dir := range dirs {
if strings.HasPrefix(strings.ToLower(dir.Name()), strings.ToLower(requestedKeymap)) {
keymaps = append(keymaps, strings.TrimSuffix(dir.Name(), ".json"))
break keymap
}
content, err = ioutil.ReadAll(T)
if err != nil {
panic(err)
}
err = json.Unmarshal(content, &tmp)
if err != nil {
panic(err)
}
fmt.Println(strings.TrimSuffix(file.Name(), ext))
keys[strings.TrimSuffix(file.Name(), ext)] = tmp
T.Close()
}
}
fmt.Println(keys)
for {
var (
r rune
flag byte
report [6]byte
)
r, _, err = stdin.ReadRune()
fmt.Printf("%s\n", string(r))
if err != nil {
panic(err)
}
changeKeymap(r, keys, args, hidg0, &currentKeyMap)
_, err = fmt.Sscanf(keys[args.ORDER[currentKeyMap]][string(r)].Modifier, "%b", flag)
binary.LittleEndian.PutUint16(report[:], uint16(keys[args.ORDER[currentKeyMap]][string(r)].Decimal))
fmt.Printf("report: % x\n", report)
fmt.Println("decimal: ", keys[args.ORDER[currentKeyMap]][string(r)].Decimal)
Press([8]byte{flag, 0, report[0], report[1], report[2], report[3], report[4], report[5]}, hidg0)
panic(fmt.Sprintf("Keymap %q not found", requestedKeymap))
}
hidg0.Close()
if filePath != "-" {
tmp, err = os.Open(path.Clean(filePath))
if err == nil {
_ = os.Stdin.Close()
os.Stdin = tmp
}
}
ghid, err = os.OpenFile(ghidPath, os.O_APPEND|os.O_WRONLY, 0600)
if err != nil {
panic(err)
}
defer ghid.Close()
keyboard = hid.NewKeyboard(hid.Modifiers, keymaps, keymapPath, ghid)
keyboard.PressDelay = pressDelay
keyboard.ReleaseDelay = releaseDelay
keyboard.KeymapShortcut, err = parse_shortcut(Shortcut)
if err != nil {
panic(fmt.Errorf("error parsing shortcut: %w", err))
}
_, err = io.Copy(keyboard, os.Stdin)
if err != nil {
panic(err)
}
fmt.Println("Success!")
}

View File

@ -1,378 +0,0 @@
{
"0" : {
"modifier": "00000000",
"decimal": 39
},
"1" : {
"modifier": "00000000",
"decimal": 30
},
"2" : {
"modifier": "00000000",
"decimal": 31
},
"3" : {
"modifier": "00000000",
"decimal": 32
},
"4" : {
"modifier": "00000000",
"decimal": 33
},
"5" : {
"modifier": "00000000",
"decimal": 34
},
"6" : {
"modifier": "00000000",
"decimal": 35
},
"7" : {
"modifier": "00000000",
"decimal": 36
},
"8" : {
"modifier": "00000000",
"decimal": 37
},
"9" : {
"modifier": "00000000",
"decimal": 38
},
"`" : {
"modifier": "00000000",
"decimal": 53
},
"[" : {
"modifier": "00000000",
"decimal": 47
},
"]" : {
"modifier": "00000000",
"decimal": 48
},
"'" : {
"modifier": "00000000",
"decimal": 52
},
"," : {
"modifier": "00000000",
"decimal": 54
},
"." : {
"modifier": "00000000",
"decimal": 55
},
"p" : {
"modifier": "00000000",
"decimal": 19
},
"y" : {
"modifier": "00000000",
"decimal": 28
},
"f" : {
"modifier": "00000000",
"decimal": 9
},
"g" : {
"modifier": "00000000",
"decimal": 10
},
"c" : {
"modifier": "00000000",
"decimal": 6
},
"r" : {
"modifier": "00000000",
"decimal": 21
},
"l" : {
"modifier": "00000000",
"decimal": 15
},
"/" : {
"modifier": "00000000",
"decimal": 56
},
"=" : {
"modifier": "00000000",
"decimal": 46
},
"\\" : {
"modifier": "00000000",
"decimal": 49
},
"a" : {
"modifier": "00000000",
"decimal": 4
},
"o" : {
"modifier": "00000000",
"decimal": 18
},
"e" : {
"modifier": "00000000",
"decimal": 8
},
"u" : {
"modifier": "00000000",
"decimal": 24
},
"i" : {
"modifier": "00000000",
"decimal": 12
},
"d" : {
"modifier": "00000000",
"decimal": 7
},
"h" : {
"modifier": "00000000",
"decimal": 11
},
"t" : {
"modifier": "00000000",
"decimal": 23
},
"n" : {
"modifier": "00000000",
"decimal": 17
},
"s" : {
"modifier": "00000000",
"decimal": 22
},
"-" : {
"modifier": "00000000",
"decimal": 45
},
";" : {
"modifier": "00000000",
"decimal": 51
},
"q" : {
"modifier": "00000000",
"decimal": 20
},
"j" : {
"modifier": "00000000",
"decimal": 13
},
"k" : {
"modifier": "00000000",
"decimal": 14
},
"x" : {
"modifier": "00000000",
"decimal": 27
},
"b" : {
"modifier": "00000000",
"decimal": 5
},
"m" : {
"modifier": "00000000",
"decimal": 16
},
"w" : {
"modifier": "00000000",
"decimal": 26
},
"v" : {
"modifier": "00000000",
"decimal": 25
},
"z" : {
"modifier": "00000000",
"decimal": 29
},
"~" : {
"modifier": "00000010",
"decimal": 53
},
"!" : {
"modifier": "00000010",
"decimal": 30
},
"@" : {
"modifier": "00000010",
"decimal": 31
},
"#" : {
"modifier": "00000010",
"decimal": 32
},
"$" : {
"modifier": "00000010",
"decimal": 33
},
"%" : {
"modifier": "00000010",
"decimal": 34
},
"^" : {
"modifier": "00000010",
"decimal": 35
},
"&" : {
"modifier": "00000010",
"decimal": 36
},
"*" : {
"modifier": "00000010",
"decimal": 37
},
"(" : {
"modifier": "00000010",
"decimal": 38
},
")" : {
"modifier": "00000010",
"decimal": 39
},
"{" : {
"modifier": "00000010",
"decimal": 47
},
"}" : {
"modifier": "00000010",
"decimal": 48
},
"\"" : {
"modifier": "00000010",
"decimal": 52
},
"<" : {
"modifier": "00000010",
"decimal": 54
},
">" : {
"modifier": "00000010",
"decimal": 55
},
"P" : {
"modifier": "00000010",
"decimal": 19
},
"Y" : {
"modifier": "00000010",
"decimal": 28
},
"F" : {
"modifier": "00000010",
"decimal": 9
},
"G" : {
"modifier": "00000010",
"decimal": 10
},
"C" : {
"modifier": "00000010",
"decimal": 6
},
"R" : {
"modifier": "00000010",
"decimal": 21
},
"L" : {
"modifier": "00000010",
"decimal": 15
},
"?" : {
"modifier": "00000010",
"decimal": 56
},
"+" : {
"modifier": "00000010",
"decimal": 46
},
"|" : {
"modifier": "00000010",
"decimal": 49
},
"A" : {
"modifier": "00000010",
"decimal": 4
},
"O" : {
"modifier": "00000010",
"decimal": 18
},
"E" : {
"modifier": "00000010",
"decimal": 8
},
"U" : {
"modifier": "00000010",
"decimal": 24
},
"I" : {
"modifier": "00000010",
"decimal": 12
},
"D" : {
"modifier": "00000010",
"decimal": 7
},
"H" : {
"modifier": "00000010",
"decimal": 11
},
"T" : {
"modifier": "00000010",
"decimal": 23
},
"N" : {
"modifier": "00000010",
"decimal": 17
},
"S" : {
"modifier": "00000010",
"decimal": 22
},
"_" : {
"modifier": "00000010",
"decimal": 45
},
":" : {
"modifier": "00000010",
"decimal": 51
},
"Q" : {
"modifier": "00000010",
"decimal": 20
},
"J" : {
"modifier": "00000010",
"decimal": 13
},
"K" : {
"modifier": "00000010",
"decimal": 14
},
"X" : {
"modifier": "00000010",
"decimal": 27
},
"B" : {
"modifier": "00000010",
"decimal": 5
},
"M" : {
"modifier": "00000010",
"decimal": 16
},
"W" : {
"modifier": "00000010",
"decimal": 26
},
"V" : {
"modifier": "00000010",
"decimal": 25
},
"Z" : {
"modifier": "00000010",
"decimal": 29
}
}