MrMarble / zmk-viewer

cli tool to generate preview images from a zmk .keymap file
MIT License
140 stars 7 forks source link

Generation failed for keyboard splitkb/kyria/rev2 #7

Closed donuts-and closed 2 years ago

donuts-and commented 2 years ago

Thank you for creating this tool. Two issues I've noticed trying to use it with the Kyria v2:

  1. The tool will complain about the output path not existing because of the path separators in the name of the output file. This can be remedied by creating the parent directory prior to running the tool. Ideally, this folder could be created as part of the execution of the tool.
  2. The output png is just one long row of 1u keys shapes rev2 .

Reproduction command (using version 1.1.0 on a Mac):

% mkdir -p splitkb/kyria
% ./zmk-viewer generate "splitkb/kyria/rev2" -D
2022-05-07T17:04:08-05:00 DBG  name=splitkb/kyria/rev2
2022-05-07T17:04:08-05:00 INF Fetching keyboard layout.
2022-05-07T17:04:08-05:00 DBG  url=https://keyboards.qmk.fm/v1/keyboards/splitkb/kyria/rev2/info.json
2022-05-07T17:04:09-05:00 DBG  Image Height=262 Image Width=747 Max X=16.5 Max Y=5.25
2022-05-07T17:04:09-05:00 DBG  Image Height=70 Image Width=2255 Max X=50 Max Y=1
2022-05-07T17:04:09-05:00 INF Image saved Path=/Users/bmtran/Downloads/zmk-viewer-1.1.0-darwin-arm64/splitkb/kyria/rev2.png
MrMarble commented 2 years ago

Thank you for using this tool!

About the first issue, I think the easiest would be to just replace the / in the name to _. That way no folder needs to be created and is still a single file with the whole name of the keyboard.

The second issue is a bit more complicated, I see there are two layouts for that keyboard and the second one is the one with the problem, you can see it at the QMK configurator https://config.qmk.fm/#/splitkb/kyria/rev2/LAYOUT_stack.

Currently, I loop over each layout (as you can see here) but I don't take in account the name of the layout, so the last one overrides the first one. Adding the name of the layout to the file should fix this problem.

MrMarble commented 2 years ago

Just released a new version fixing both issues.

Thanks for reporting them!

donuts-and commented 2 years ago

Thank you for resolving this so quickly! I’m excited to try it out again.

donuts-and commented 2 years ago

Works great! Thank you again for creating this!