Open kiryph opened 2 years ago
That's a massive use case of key chords! I can imagine too many active event taps could lead to an unreliable state because the event loop of the operating system has strict time constraints. Under the hood knu.chord
creates one event tap for each chord, so it may not scale well.
Instead of using knu.chord, I'd suggest you use Karabiner-Elements for the chord part, mapping simultaneous non-modifier key combinations to modifiers + single keys, and then define them as hotkeys on Hammerspoon.
Apart from that, I cannot deny an overlapping set of key chords could not work well, depending on the order of definitions. Each event tap created for a key chord holds key events for a certain amount of time, and when those are accumulated to be more than a timeout of the later chord, it will always fail to form.
This could be fixed by making a giant event tap that would check all defined chords, but that's going to be a lot of work.
Thanks for your comments.
I can imagine too many active event taps could lead to an unreliable state because the event loop of the operating system has strict time constraints.
I also suspect this.
Instead of using knu.chord, I'd suggest you use Karabiner-Elements for the chord part, mapping simultaneous non-modifier key combinations to modifiers + single keys, and then define them as hotkeys on Hammerspoon.
I have tried Karabiner Elements. Karabiner Elements actually offers also to.shell_command
so I do not have to remap to modifier + single key. Since I have written the function create_svg_and_paste(keys)
for hammerspoon:
I will simply call the lua-hammerspoon function from the cli
"shell_command": "/usr/local/bin/hs -c 'hs.alert(\"e+␣\");create_svg_and_paste({\"e\",\"space\"});'"
This uses
This is an improvement. So all two-letter combinations work. However, the three-letter combinations do not yet. There are a few options I have not tested comprehensively
"basic.simultaneous_threshold_milliseconds": 200,
"basic.to_if_alone_timeout_milliseconds": 1000,
and the
simultaneous_options
detect_key_down_uninterruptedly
.
This could be fixed by making a giant event tap that would check all defined chords, but that's going to be a lot of work.
I think this is what the original author did. And I guess this could also be possible with hammerspoon eventtap.
I try to adapt Key chords to apply commonly used styles to Inkscape objects on macOS.
The list of key chords are shown in this graphic
The author has published his key chord setup on github https://github.com/gillescastel/inkscape-shortcut-manager for linux.
I have already managed to adapt the creation of svg snippets for pasting. The remaining issue is that defining a large overlapping set of key chords using https://github.com/knu/hs-knu/blob/master/chord.lua does not work as expected. Only a subset works.
@knu Do you know where the issue is located and how one could resolve it?