zmk-viewer
zmk-viewer copied to clipboard
adding keyboards that aren't available at qmk configurator?
Is it possible to add support for keyboards that aren't currently available on the qmk configurator, e.g. smores' clog (https://www.smoresboards.com/product/clog https://github.com/smores56/zmk-config-clog)?
I use qmk configurator to fetch the keyboard layout, that way I don't have to manually create the layout of each keyboard. See for example this one:
JSON Layout
https://keyboards.qmk.fm/v1/keyboards/basketweave/info.json
{
"last_updated": "2022-03-26 01:07:21 GMT",
"keyboards": {
"basketweave": {
"keyboard_name": "Basketweave",
"keyboard_folder": "basketweave",
"keymaps": {},
"layouts": {
"LAYOUT_default": {
"layout": [
{
"x": 0,
"y": 0,
"w": 1,
"label": "Esc",
"matrix": [
0,
0
]
},
{
"x": 1.5,
"y": 0,
"w": 1,
"label": "~",
"matrix": [
0,
1
]
},
{
"x": 2.5,
"y": 0,
"w": 1,
"label": "!",
"matrix": [
0,
2
]
},
{
"x": 3.5,
"y": 0,
"w": 1,
"label": "@",
"matrix": [
0,
3
]
},
{
"x": 4.5,
"y": 0,
"w": 1,
"label": "#",
"matrix": [
0,
4
]
},
{
"x": 5.5,
"y": 0,
"w": 1,
"label": "$",
"matrix": [
0,
5
]
},
{
"x": 6.5,
"y": 0,
"w": 1,
"label": "%",
"matrix": [
0,
6
]
},
{
"x": 7.5,
"y": 0,
"w": 1,
"label": "^",
"matrix": [
0,
7
]
},
{
"x": 10.5,
"y": 0,
"w": 1,
"label": "&",
"matrix": [
0,
8
]
},
{
"x": 11.5,
"y": 0,
"w": 1,
"label": "*",
"matrix": [
0,
9
]
},
{
"x": 12.5,
"y": 0,
"w": 1,
"label": "(",
"matrix": [
0,
10
]
},
{
"x": 13.5,
"y": 0,
"w": 1,
"label": ")",
"matrix": [
0,
11
]
},
{
"x": 14.5,
"y": 0,
"w": 1,
"label": "_",
"matrix": [
0,
12
]
},
{
"x": 15.5,
"y": 0,
"w": 1,
"label": "+",
"matrix": [
0,
13
]
},
{
"x": 16.5,
"y": 0,
"w": 2,
"label": "Backspace",
"matrix": [
0,
14
]
},
{
"x": 0,
"y": 1,
"w": 1,
"label": "Insert",
"matrix": [
1,
0
]
},
{
"x": 1.5,
"y": 1,
"w": 1.5,
"label": "Tab",
"matrix": [
1,
1
]
},
{
"x": 3,
"y": 1,
"w": 1,
"label": "Q",
"matrix": [
1,
2
]
},
{
"x": 4,
"y": 1,
"w": 1,
"label": "W",
"matrix": [
1,
3
]
},
{
"x": 5,
"y": 1,
"w": 1,
"label": "E",
"matrix": [
1,
4
]
},
{
"x": 6,
"y": 1,
"w": 1,
"label": "R",
"matrix": [
1,
5
]
},
{
"x": 7,
"y": 1,
"w": 1,
"label": "T",
"matrix": [
1,
6
]
},
{
"x": 10,
"y": 1,
"w": 1,
"label": "Y",
"matrix": [
1,
7
]
},
{
"x": 11,
"y": 1,
"w": 1,
"label": "U",
"matrix": [
1,
8
]
},
{
"x": 12,
"y": 1,
"w": 1,
"label": "I",
"matrix": [
1,
9
]
},
{
"x": 13,
"y": 1,
"w": 1,
"label": "O",
"matrix": [
1,
10
]
},
{
"x": 14,
"y": 1,
"w": 1,
"label": "P",
"matrix": [
1,
11
]
},
{
"x": 15,
"y": 1,
"w": 1,
"label": "{",
"matrix": [
1,
12
]
},
{
"x": 16,
"y": 1,
"w": 1,
"label": "}",
"matrix": [
1,
13
]
},
{
"x": 17,
"y": 1,
"w": 1.5,
"label": "|",
"matrix": [
1,
14
]
},
{
"x": 19,
"y": 0.5,
"w": 1,
"label": "Mute",
"matrix": [
4,
14
]
},
{
"x": 0,
"y": 2,
"w": 1,
"label": "Delete",
"matrix": [
2,
0
]
},
{
"x": 1.5,
"y": 2,
"w": 1.75,
"label": "Caps Lock",
"matrix": [
2,
1
]
},
{
"x": 3.25,
"y": 2,
"w": 1,
"label": "A",
"matrix": [
2,
2
]
},
{
"x": 4.25,
"y": 2,
"w": 1,
"label": "S",
"matrix": [
2,
3
]
},
{
"x": 5.25,
"y": 2,
"w": 1,
"label": "D",
"matrix": [
2,
4
]
},
{
"x": 6.25,
"y": 2,
"w": 1,
"label": "F",
"matrix": [
2,
5
]
},
{
"x": 7.25,
"y": 2,
"w": 1,
"label": "G",
"matrix": [
2,
6
]
},
{
"x": 10.25,
"y": 2,
"w": 1,
"label": "H",
"matrix": [
2,
7
]
},
{
"x": 11.25,
"y": 2,
"w": 1,
"label": "J",
"matrix": [
2,
8
]
},
{
"x": 12.25,
"y": 2,
"w": 1,
"label": "K",
"matrix": [
2,
9
]
},
{
"x": 13.25,
"y": 2,
"w": 1,
"label": "L",
"matrix": [
2,
10
]
},
{
"x": 14.25,
"y": 2,
"w": 1,
"label": ":",
"matrix": [
2,
11
]
},
{
"x": 15.25,
"y": 2,
"w": 1,
"label": "\"",
"matrix": [
2,
12
]
},
{
"x": 16.25,
"y": 2,
"w": 2.25,
"label": "Enter",
"matrix": [
2,
13
]
},
{
"x": 1.5,
"y": 3,
"w": 2.25,
"label": "Shift",
"matrix": [
3,
1
]
},
{
"x": 3.75,
"y": 3,
"w": 1,
"label": "Z",
"matrix": [
3,
2
]
},
{
"x": 4.75,
"y": 3,
"w": 1,
"label": "X",
"matrix": [
3,
3
]
},
{
"x": 5.75,
"y": 3,
"w": 1,
"label": "C",
"matrix": [
3,
4
]
},
{
"x": 6.75,
"y": 3,
"w": 1,
"label": "V",
"matrix": [
3,
5
]
},
{
"x": 7.75,
"y": 3,
"w": 1,
"label": "B",
"matrix": [
3,
6
]
},
{
"x": 9.75,
"y": 3,
"w": 1,
"label": "B",
"matrix": [
3,
7
]
},
{
"x": 10.75,
"y": 3,
"w": 1,
"label": "N",
"matrix": [
3,
8
]
},
{
"x": 11.75,
"y": 3,
"w": 1,
"label": "M",
"matrix": [
3,
9
]
},
{
"x": 12.75,
"y": 3,
"w": 1,
"label": "<",
"matrix": [
3,
10
]
},
{
"x": 13.75,
"y": 3,
"w": 1,
"label": ">",
"matrix": [
3,
11
]
},
{
"x": 14.75,
"y": 3,
"w": 1,
"label": "?",
"matrix": [
3,
12
]
},
{
"x": 15.75,
"y": 3,
"w": 1.75,
"label": "Shift",
"matrix": [
3,
13
]
},
{
"x": 17.75,
"y": 3.25,
"w": 1,
"label": "Up",
"matrix": [
2,
14
]
},
{
"x": 1.5,
"y": 4,
"w": 1.5,
"label": "Ctrl",
"matrix": [
4,
1
]
},
{
"x": 4.5,
"y": 4,
"w": 1.5,
"label": "Alt",
"matrix": [
4,
2
]
},
{
"x": 6,
"y": 4,
"w": 2,
"label": "Space",
"matrix": [
4,
4
]
},
{
"x": 8,
"y": 4,
"w": 1,
"label": "Fn",
"matrix": [
4,
6
]
},
{
"x": 9.75,
"y": 4,
"w": 2.75,
"label": "Space",
"matrix": [
4,
8
]
},
{
"x": 12.5,
"y": 4,
"w": 1.5,
"label": "Alt",
"matrix": [
4,
10
]
},
{
"x": 15,
"y": 4,
"w": 1.5,
"label": "Ctrl",
"matrix": [
4,
11
]
},
{
"x": 16.75,
"y": 4.25,
"w": 1,
"label": "Left",
"matrix": [
4,
12
]
},
{
"x": 17.75,
"y": 4.25,
"w": 1,
"label": "Down",
"matrix": [
4,
13
]
},
{
"x": 18.75,
"y": 4.25,
"w": 1,
"label": "Right",
"matrix": [
3,
14
]
}
],
"filename": "keyboards/basketweave/basketweave.h",
"c_macro": true
}
}
}
}
}
Should be possible to define a custom layout following that format and pass it as an argument to the program, if anyone is willing to write that file manually I can add that method.
This is the repository holding all the keyboards available: https://github.com/qmk/qmk_keyboards It hasn't been updated in a year, maybe is worth to open an issue to qmk to see if they can update it.
Sure, if it's easy for you to add that method, that might be the easiest thing to do in the short term, and would be very much appreciated. It's probably not going to be feasible to try to upstream every custom board out there to qmk_keyboards
OK, I'm adding a template system to create the custom layouts so it's a bit easier.
This is the template for smore's clog:
keyboard:
name: The Clog # optional not used
mirror: true # only need to specify half of the keyboard
columns:
- keys: 1 # number of keys in the column
step: 3 # offset from top
- keys: 2
step: 2.5
- keys: 3
step: 0.5
- keys: 3
- keys: 3
step: 0.5
- keys: 4
step: 0.5
keys:
- column: 6 # thumb key
row: 2
step: 0.9
h: 1.7 # to target the custom height of the key
This is the result of running zmk-viewer generate clog --template theClog.yaml
:
I also discovered some bugs in my code parsing clog's keymap file, I'm working on it, this should be the end result:
zmk-viewer generate clog --template theClog.yaml -f clog.keymap
I'll try to release a new version soon with the changes
thanks!!
Unrelatedly, is it possible to use your app to show zmk combos on the keymap too?
Not yet, I have to think of a way to represent them. I had thought about coloring the keys, but they can be repeated in different combos so I discarded it. Maybe the easiest way is to generate an extra image that has all the combos in a list.
I think it'd be better to have it as an overlay if possible. What about representing a combo by coloring (or using dots or dashes) the outline / boundary around the keys? That way you can represent combos with overlapping keys as stacked boundaries / outlines. And then you could add text labels in small font near the boundary / outline.
Might want to take a look at Ergogen too: they have a similar parametric description of a keyboard.