caksoylar / keymap-drawer

Visualize keymaps that use advanced features like hold-taps and combos, with automatic parsing
https://caksoylar.github.io/keymap-drawer
MIT License
707 stars 59 forks source link

Feature request: export layout config for the GitHub action #47

Open dhruvinsh opened 1 year ago

dhruvinsh commented 1 year ago

While using the keymap-drawer action, if the draw_args are provided for type of keyboard or layout as a override, can we please put this details in the keyboard.yaml (keymap yaml) file in the output folder.

      draw_args: "lynx:'-k ferris/sweep -l LAYOUT_split_3x5_2'"

would have output in lynx.yaml config as

layout:
  qmk_keyboard: ferris/sweep
  qmk_layout: LAYOUT_split_3x5_2

This way I can just use the whole config file in the online svg editor.

caksoylar commented 1 year ago

It sounds reasonable. While keymap draw augments the internal keymap representation with the command line options it receives, there is no way to export that internal representation afterwards. There can be an additional command line switch to do that.

As an aside, this might also help #8. In that case, if the input YAML doesn't have combo placement hints, keymap draw would automatically determine the best ones. But I wasn't sure how I could expose these back to the user. This might be one way, i.e. output an augmented YAML as a result of the drawing.

dhruvinsh commented 1 year ago

Perhaps keymap parse and keymap draw can share the same argument for the layout?

That way we can use parse to feed layout info and update the keymap yaml file, and draw works as is without breaking any functionality, and it does have a check to look at the argument or the config file

If you are okay with this I can send you a pull requests.

caksoylar commented 1 year ago

That's true, it can be another solution to override the layout that the parser comes up with. You can make a PR for it -- ideally we would duplicate too much logic for the validation/assignment, but if that will make the PR complicated I might rather refactor it myself in the future.