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
730 stars 62 forks source link

Separate Combos on ZMK #53

Closed t18n closed 1 year ago

t18n commented 1 year ago

Combos are valid across all layers so showing it multiple times is not necessary. Also, it covers the keys if someone uses combos extensively. I think having a separate draw for combo only would be a better approach image

caksoylar commented 1 year ago

I don't intend to change the default behavior since I think the diagram should reflect the true behavior, i.e. that combos can be triggered on all layers by default. However there are a few options to draw combos separately:

  1. Use --keys-only or --combos-only options in the command line to draw layers without combos, then layers with only combos. You can combine the latter with --select-layers to only draw combos for one of the layers.
  2. Use separate_combo_diagrams draw config option, which draws all of them like below. This option ignores the layer filter completely. 0f957bdc-2da2-4369-be8c-2135058e63d4
  3. Use zmk_combos parse config to override the layers property for each combo
t18n commented 1 year ago

Thank you @caksoylar. Do you have an example on how to add these flags into the Github actions config? Here is my current config https://github.com/t18n/zmk-config-corne/blob/main/.github/workflows/draw-keymaps.yml

caksoylar commented 1 year ago

Doing 2. or 3. is simple: Just add a config file (see https://github.com/t18n/zmk-config-corne/blob/main/.github/workflows/draw-keymaps.yml#L18 on where to put it in the repo) and add the options I mentioned. E.g. for option 2 the minimum content you need is

draw_config:
  separate_combo_diagrams: true

You can see the community section in the README for config file examples: https://github.com/caksoylar/keymap-drawer#community. Mine is here: https://github.com/caksoylar/zmk-config/blob/main/keymap-drawer/config.yaml

Approach 1. is more complicated since it involves calling keymap draw multiple times with different arguments. While you can pass command line arguments using this option https://github.com/t18n/zmk-config-corne/blob/main/.github/workflows/draw-keymaps.yml#L21 it will still call the command once. You'd need to modify the reusable workflow file at https://github.com/caksoylar/keymap-drawer/blob/main/.github/workflows/draw-zmk.yml or incorporate a modified version into your file above to do that.

caksoylar commented 1 year ago

I'll close the issue, but please let me know if you have any issues implementing the suggestions above.