-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Read chords from simple text file #984
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of introducting another file with it's own format for defining chords, maybe a config item could be added to .kbd configurtion e.g.:
(def-chords-v2-dictionary
an and
as as
or or
bu but
if if
so so
dn then
bc because
)
c05de89
to
20a903d
Compare
@jtroo @rszyma @SequentialDesign would you mind giving this a try? Approach
Caveats
|
79d8dc4
to
1fe9546
Compare
I consider overlapped key sequences a failed experiment 😆. They might work in simpler use cases but not under heavy usage.
Hm that's surprising, sounds like a bug somewhere... though no specific pointers off the top of my head. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! I haven't tried it out yet, but hopefully soon :)
.map(|c| self.post_process(&c.to_string())) | ||
.collect_vec(); | ||
// Wait 50ms for one-shot Shift to release | ||
// TODO: This would be better handled by a (multi (release-key lsft)(release-key rsft)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would rely on a tap-vkey
. For a "worse-is-better" solution, using this functionality could mandate a virtual key with a specific name that does the specific function 😅. I haven't thought too hard about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This relates to a general concern I've been thinking about:
Mapping all the functionality from a ZipChord chord definition requires more than just entries in the defchordsv2-experimental
section. E.g. the suffix stuff is currently handled via sequences which are top-level in the config. The tap-vkey
is another indicator that the chording might have to live in the top-level config, so that it can instantiate everything required for a seamless experience, and require the user to add magic stuff elsewhere in his config.
I'd be very thankful for your ideas and opinion here @jtroo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To address this point specifically, I would be fine with to have the documentation+error message mandate an item like below to use include
:
(defvirtualkeys release-shift (multi (release-key lsft) (release-key rsft)))
The code could even validate that the action matches exactly too. The information required to do these validations is found in ParserState.virtual_keys
. The generated macro
that gets created would then use a on-press tap-vkey release-shift
.
At a higher level, my overall impression is that this PR is a great step in improving the convenience of using today's chords. I would merge it when it's ready, if we want to keep it as-is. However, to get even closer to ZipChord-like or Plover-like functionality, it would IMO be best done with a dedicated feature. As discovered in our experimentation, stitching together Kanata's existing features - chordsv2+sequences - to emulate ZipChord doesn't work perfectly.
My first thought would be to port https://github.com/psoukie/zipchord/blob/main/source/io.ahk as highlighted by psoukie into the output feed of kanata at https://github.com/jtroo/kanata/blob/main/src/kanata/output_logic.rs . At least from my initial impression ZipChord seems easier to port than Plover, so seems like a good starting point. On the point of where the implementation would be, my feeling is that adapting/extending the ZMK-inspired chording, which is done at the Keyberon state machine level, is probably not preferable.
@rszyma sorry I had not responded to your comments yet. I was busy experimenting 😉 I see a few complications with inlining the definition into a
|
@jtroo from my side it would be great to merge the PR (once it's good to go from your side) and do a follow-up with improvements. |
Great idea, hopefully the most annoying part can eventually get resolved! Just a few thoughts on the lesser aspect:
You could "inline" it in a separate file that will be imported into the main config file, so the only difference from your Whitespace is better dealt with via quotes? For example, what if you want to add a space before an expansion, that might visually be a challenge to differentiate from the tab before. Or what if you want more whitespace between chord,expansion for alignment? Or what if you want to expand into a tab-separated pair? Also you could eventually add more complicated instructions to individual chords (or all of the chording block) if you use the more flexible/extensible .kbd config
Could this maybe be one special exception to the |
This PR is a first shot at implementing a more scalable chording approach using a simple text file for configuration. See: - jtroo#979 - https://github.com/jtroo/kanata/assets/35170/d51a4669-ce8c-4355-9124-53c47a1cdd47
Describe your changes. Use imperative present tense.
This PR is a first shot at implementing a more scalable chording approach using a simple text file for configuration (see #979)
Kanata.Chording.mp4
Checklist