Keymap-drawer

Latest version: v0.19.0

Safety actively analyzes 682387 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 4

0.8.0

This release has a few improvements mainly related to ZMK keymap parsing, including support for mod-morphs and custom sticky keys.

Features
- **Refactored ZMK parsing** to use `compatible` fields to determine nodes of interest
- Previously we relied on other heuristics based on node names, which were usually satisfied by convention. Current approach emulates Zephyr's parsing so any keymap that works with ZMK should now be parsed correctly
- The new [`dts.py` module](keymap_drawer/dts.py) is a parser that can be used standalone for other ZMK-related projects
- Added **parsing for mod-morphs**, which assigns the morphed behavior to the `shifted` field
- Added **parsing for custom sticky key behaviors**, in addition to the built-ins `&sk`/`&sl`
- Made **hold-taps parse its bindings recursively** (similar to the above two), so that its output is more accurate
- Previously this also relied on heuristics that mostly worked for `&kp/&kp` and `&mo/&kp` hold-taps
- Added a new drawing config `draw_config.shrink_wide_legends` (enabled by default) to **automatically shrink legends that are too wide**
- This is currently not designed ideally, since the optimal value depends on the font size and rect/combo box width. The default value should work well with other defaults, but it is not ideal for combo boxes. I thought it is still a good improvement but I will re-implement this if I can come up with a better way. **Feedback is welcome!**

Fixes
- Run the keys of `parse_config.raw_binding_map` through the preprocessor before using them (11)
- This fixes cases like `raw_binding_map: {"&lt NUM ESC": "my hold-tap"}` where `NUM` gets replaced by a preprocessor define

**Full Changelog**: https://github.com/caksoylar/keymap-drawer/compare/v0.7.1...v0.8.0

0.7.1

This is a bug fix release for the changes related to features introduced in v0.7.0.

Fixes
- Allow unicode characters in dumped YAMLs, e.g. to output `▽` instead of `"\u25BD"`
- Do not clear legends for held keys during keymap parsing unless it is transparent (23)
- Outputs for inferred `held` keys are now as it was before v0.7.0
- Increase compatibility of embedded custom SVGs with Inkscape 1.2.2 and before

Web app
- Expand the configuration section by default, to work around the issue where the configuration text box is occasionally empty

**Full Changelog**: https://github.com/caksoylar/keymap-drawer/compare/v0.7.0...v0.7.1

0.7.0

This is a large and overdue update, with various improvements to both parsing and drawing functionality. Highlight of this update is the ability to integrate custom SVG glyphs which can be automatically fetched from a number of fixed sources like [Tabler](https://tabler-icons.io/) or [MDI](https://pictogrammers.com/library/mdi/).

Features
- Added the ability to use custom SVG glyphs as key legends by Lugoues, see [the README section](https://github.com/caksoylar/keymap-drawer/blob/main/README.md#custom-glyphs) for details and [`showcase.yaml`](https://github.com/caksoylar/keymap-drawer/blob/main/examples/showcase.yaml) for an example
- SVG glyphs can be defined in the `draw_config.glyphs` field of the configuration, or fetched from URLs
- Four icon sources are currently supported for automated fetching with a short-hand, e.g. [`$$tabler:volume$$`](https://tabler-icons.io/i/volume)
- Fetched SVGs are cached in a user cache folder to speed up consequent runs
- Added a `slide` field to the [combo definitions](https://github.com/caksoylar/keymap-drawer/blob/main/KEYMAP_SPEC.md#combos) to allow more flexible combo positioning, with expected value between -1 and 1
- Changing this value "slides" the combo box along an axis between keys -- can be used for moving `top`/`bottom` combo boxes left/right, `left`/`right` boxes up/down, or `mid` combos between two keys
- `keymap parse` now outputs a symbol `▽` for transparent keys and assigns it a CSS class that grays out the legend by default
- Configurable via `parse_config.trans_legend` value
- Added a reusable Github workflow to automatically generate keymap SVGs in ZMK user config repos
- See [the section in README](https://github.com/caksoylar/keymap-drawer#setting-up-an-automated-drawing-workflow) on how to integrate to your own config repo

Fixes
- Fixed unnecessary drawing of combo arcs, which are usually hidden behind the combo box

Misc
- Added physical layouts for `dao`, `glove80` and `adv360`, latter using the 84 binding transform used in [the official config](https://github.com/KinesisCorporation/Adv360-Pro-ZMK)
- Added a `devcontainer` for development in VS Code, by Lugoues

New Contributors
- Various contributions detailed above by Lugoues
- calumy made their first contribution in https://github.com/caksoylar/keymap-drawer/pull/19

**Full Changelog**: https://github.com/caksoylar/keymap-drawer/compare/v0.6.0...v0.7.0

0.6.0

This release focuses mostly on improvements to keymap parsing, to reduce the amount of manual tweaking necessary before drawing and better accomodate an end-to-end, parse-then-draw workflow.

Fixes
- Fixed layout size calculation so that the dimensions of drawn layers in the SVG are properly adjusted when using rotated keys

Features
- Made parsing smarter to automatically determine held keys using momentary layer keys on the keymap, so the user should no longer need to manually add `type: held` specs after parsing
- Does not currently support the conditional layers feature in ZMK, or more than one way to activate the same layer
- Added a base keymap `-b/--base-keymap` parameter to `keymap parse`. This will make the parser try its best to copy your manual modifications from the base keymap to the updated one after parsing, including combo `align` and `offset` values and `type` specifiers in layer keys
- Added a `-l/--layer-names` parameter to `keymap parse` that lets you override layer names, especially useful for QMK parsing where there is no layer name information in the parse input json
- Added `parse_config.zmk_combos` configuration to let the user automatically augment the parse output for combos, specified by the node name in the ZMK keymap, e.g. `combo_esc: {align: top, offset: 0.5}`
- Added `parse_config.sticky_label` configuration to let the user change the "sticky" display text for sticky/one-shot keys

Misc
- Added a simple Github workflow for linting
- Added `fingerpunch/ffkb` and `fingerpunch/luakeeb` physical layouts

Looking forward, Lugoues is working on integrating custom SVG glyphs to be used a legends in the drawing output in 12 and 17 so users will no longer be limited to using unicode text and symbols!

**Full Changelog**: https://github.com/caksoylar/keymap-drawer/compare/v0.5.0...v0.6.0

0.5.0

The highlight of this release is automatic physical layout detection for most ZMK keyboards, as determined by the keymap filename. For instance parsing `corne.keymap` [will add](https://github.com/caksoylar/keymap-drawer/blob/a02814e/resources/zmk_keyboard_layouts.yaml#L27) a `layout: {qmk_keyboard: crkbd/rev1, qmk_layout: LAYOUT_split_3x6_3}` field to the output keymap YAML, so you won't have to manually specify it during `keymap draw`. (There is no support yet for determining the correct `qmk_layout` via the chosen matrix transform.)

To support more ZMK (and custom QMK) keyboards, I also started maintaining some extra physical layout definitions under the [`resources` folder](https://github.com/caksoylar/keymap-drawer/tree/main/resources/qmk_layouts). If a `qmk_keyboard` name matches one of the files here then that will be used rather than checking QMK keyboards API. For example, if you use `keymap draw -k corne_rotated` instead of `crkbd/rev1` you will get a [Corne layout with nicely rotated thumb keys](https://caksoylar.github.io/keymap-drawer?keymap_yaml=H4sIAAAAAAAC_2WPS0-DQBSF9_0VJ2zcXHXRuGFHC62PPlRolTaGUDoK6VhwmCYSw38vA1NCcDU55zv33Ds8LNKTNAfAz_chOLBil4ZibyJKxZEFIpWhZHtNeZPFzPKXKy_IM57IYPh7FwwHFWIiVzW2M1EPcI3tC-GN4BBeCR7BJ6wID4Ql4fnjEvqLTYyl4ISq2ioJypieklq7Wltc1trW2o2Tz8aZVM6UcN_3H3uTT73mmdbtauPKKNujNoR3wpiwJowIC8KcYJBBuCHcXmJtH1SBF-6qoiJjJr7iNJdlJ9VsUSknj7pgYa31-MjNwoh1mevPNfuP2n86R8lEF9UfrqdsxplkvZvORV3F4vEBAAA%3D).

See the newly updated [`layout` section in the keymap spec](https://github.com/caksoylar/keymap-drawer/blob/main/KEYMAP_SPEC.md#layout) for details.

Features
- Automatically determine physical layouts for most ZMK keyboards during parsing
- Mapped from keymap filename using [the mapping file](https://github.com/caksoylar/keymap-drawer/blob/main/resources/zmk_keyboard_layouts.yaml)
- Contributions welcome to add mappings for custom ZMK keyboards/shields!
- Add custom physical layout definitions for non-QMK-upstream keyboards
- Maintained under [`resources/qmk_layouts`](https://github.com/caksoylar/keymap-drawer/tree/main/resources/qmk_layouts)
- Contributions welcome to support more keyboards! See [Keymap Layout Helper](https://nickcoutsos.github.io/keymap-layout-tools/) and [other resources](https://github.com/caksoylar/keymap-drawer/blob/main/KEYMAP_SPEC.md#layout) to help generate new layouts.
- Make `qmk_keycode_map`/`zmk_keycode_map` support key spec dicts (e.g. including `hold` or `shifted` fields), e.g. `SLASH: {t: '/', shifted: '?'}`
- Assign CSS class `layer-<layer_name>` to each layer so they can be styled individually through [`svg_style`](https://github.com/caksoylar/keymap-drawer/blob/main/keymap_drawer/config.py#L54) (thanks manna-harbour!)

**Full Changelog**: https://github.com/caksoylar/keymap-drawer/compare/v0.4.0...v0.5.0

0.4.0

This release adds rotation center `rx, ry` support to QMK-format physical layouts, consistent with the handling of [`keymap-editor`](https://github.com/nickcoutsos/keymap-editor) and [Keymap Layout Helper](https://nickcoutsos.github.io/keymap-layout-tools/) (and KLE). Note that at the moment the default rotation center is key center if former are not specified, different from aforementioned tools which use top left corner, or `0, 0` origin that KLE uses ([related issue](https://github.com/nickcoutsos/keymap-editor/issues/76)).

There is also an important bug fix for parsing with the columns specifier and contributions by jbarr21 for improved parsing of QMK keymaps (thanks!).

Fixes
- Fix keymap parse dumping when `-c/--columns` value is specified to a non-default value
- Ignore labels `label: nodename` when looking for `keymap`, `behaviors` etc. nodes in ZMK keymaps

Features
- Support `rx, ry` fields in QMK info.json for specifying the point around which the angle `r` will be used to rotate
- Replace underscores with spaces in unmapped QMK keys by jbarr21 in https://github.com/caksoylar/keymap-drawer/pull/5
- Add parsing for QMK one-shot mods & layers by jbarr21 in https://github.com/caksoylar/keymap-drawer/pull/4

New Contributors
* jbarr21 made their first contribution in https://github.com/caksoylar/keymap-drawer/pull/5

**Full Changelog**: https://github.com/caksoylar/keymap-drawer/compare/v0.3.0...v0.4.0

Page 3 of 4

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.