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
660 stars 57 forks source link

Can't map "&rgb_ug RGB_COLOR_HSB(0, 0, 60)" using "raw_binding_map" on the config #102

Closed Townk closed 3 months ago

Townk commented 3 months ago

I have a layout that uses a KD configuration with several key labels replaced with symbols. One of my layers has buttons to deal with RGB Underglow. One of the keys, is supposed to reset the Underglow to the default value I set in the config file. The layer should look like this:

corne42-layer4-media

But, if I don't do some workaround with search and replace on the KD layout file, the layer look like this:

corne42-layer4-media

I define the "RGB reset" key on my layout, in this line. For convenience, this is a snippet from my config:

&rgb_ug RGB_RESET

The RGB_RESET I used there, is a macro defined in another file, but its content is the following:

// RGB Helpers
#define RGB_RESET            RGB_COLOR_HSB(0, 0, 60)

Like all keys I want to replace with a symbol, I defined a raw_binding_map entry to replace the RGB key with the proper asset:

parse_config:
  raw_binding_map:
    # RGB Underglow
    "&rgb_ug RGB_COLOR_HSB(0, 0, 60)": { t: "$$mdi:palette-outline$$", h: "reset" }

I also tried to use the RGB_RESET macro:

parse_config:
  raw_binding_map:
    # RGB Underglow
    "&rgb_ug RGB_RESET": { t: "$$mdi:palette-outline$$", h: "reset" }

But I think the KD preprocessor replaces it, do it does not work.

The request for this ticket is:

Is there a way to replace that key definition using raw_binding_map?

caksoylar commented 3 months ago

Thanks again for reporting. I found a bug where I assumed there wouldn't be commas in the bindings, now it should be handled properly. I tested your config locally and it seems to be fixed but can you confirm as well?

Townk commented 3 months ago

Yep, I can confirm the issue is solved. Thank you so much for the quick response!