kas-gui / kas

Another GUI toolkit
Apache License 2.0
892 stars 27 forks source link

ShellBuilder, config load/save tweaks, new shortcut serialization format, enable TOML #416

Closed dhardy closed 8 months ago

dhardy commented 8 months ago

Fixes #414.

dhardy commented 8 months ago

This PR brings TOML support and a much nicer serialization format:

[shortcuts.none]
F1 = "Help"
F2 = "Rename"
# ...

[shortcuts.shift]
F3 = "FindPrevious"

[shortcuts.alt]
ArrowDown = "NavDown"
ArrowLeft = "NavPrevious"
# ...

[shortcuts.ctrl]
Tab = "TabNext"
ArrowDown = "ViewDown"
ArrowLeft = "WordLeft"
a = "SelectAll"
# ...

[shortcuts.ctrl-shift]
Tab = "TabPrevious"
ArrowDown = "ViewDown"
ArrowLeft = "WordLeft"
# ...

Single-char keys bind to some Key::Character, others bind to Key::Named. Shortcuts using longer Character variants, Unidentified or Dead are serialized using a different format under another (array) table, shortcuts.other.

Limitation: this might not be the most appropriate format for app-specific shortcuts. I'd prefer bindings to e.g. Command::WordLeft, but lack the patience/incentive to wrangle that out of serde for now. (This format is also assumptive that all app-specific bindings would be to a path, though making such a restriction should be acceptable given that the value is just a trigger fed to trigger some widget action.)