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

Pull in symbols for numbers automatically from zmk config #93

Closed griccardos closed 6 months ago

griccardos commented 6 months ago

when reading number_1, number_2 etc. from zmk config, only the numbers are pulled in ('1', '2' etc.) and only those are shown in the image. One needs to change the yaml '1' to {t:'1' , s:'!'} everytime one pulls in a config file for each number Have an option for automatically pulling in the symbols for number_0 to number_9 or maybe an option for showing the symbols above

caksoylar commented 6 months ago

Hey, just to make sure you are aware of it, overrides can be set in the parse_config.zmk_keycode_map configuration, which is under the "Raw configuration" box in the web app. So e.g. you could write the following:

parse_config:
  # ...other items
  zmk_keycode_map:
    # ...existing default values
    N1: {t: 1, s: "!"}
    N2: {t: 2, s: "@"}
    # ...etc

This way you can parse keymaps multiple times and the substitution will happen automatically. (Configuration isn't persisted across page reloads, so you might want to keep a copy of it somewhere for the next time you'll use the web page.)

I previously thought about just adding these to the default map values; there isn't much downside to that except that it is a breaking change. One issue is that the shifted number values can be different for different locales, but that's probably fine for now. What do you think?

griccardos commented 6 months ago

Ah, i see, one can save the parse config. That would work. I guess it depends on what others want. Some would only want to see numbers on their number layer. I don't separate my symbols, but use the symbols on the numbers, so I like seeing the symbols with the numbers. I guess you could leave it like this for now, unless there are more requests for it. It would be nice though to have configuration persist, possibly storing in local storage ( i think someone opened an issue for that already). I like coming to this page, uploading a keymap to see what it looks like, so saving my default settings would be great. And if storing to local storage, restoring the last keymap used would also be great.

caksoylar commented 6 months ago

Agreed on the persistence, I am aware that experience for multiple visits isn't ideal right now. Unfortunately I haven't cracked how to do persistence reliably in Streamlit, but I'll keep it in mind.

Meanwhile, let me know if you think of a temporary solution that would make it less painful for you. Like a import button or a copy to clipboard button, etc.

griccardos commented 6 months ago

No, i think copying pasting into the current editor works perfectly. You can go ahead and close if you wish... I will comment on the persistence thing on that issue...