Open reidprichard opened 7 months ago
So there will be some predictable naming convention for process names/fake-keys? Works for me :)
Yes, I'm thinking I'll have a command line argument to choose between the following behaviors:
If there's interest I could add a functionality, e.g.:
I think I've reverse-engineered Kanata enough to figure out how to press fake keys over TCP, so once I have time I should be able to get this moving.
Without getting too much into the specifics of Kanata,
layer-switch
activates the base layer whilelayer-while-held
/layer-toggle
activates the "active" layer. The "active" layer overrides the "base" layer, but_
in the active layer falls through to the corresponding key of the base layer;_
in the base layer falls through to the corresponding key indefsrc
.Kanata's developer does not plan to expose
layer-while-held
directly via TCP, but he plans to expose press/release/tap/toggle actions for fake keys.As a workaround, I think I can add an option so that kanata_helper_daemon follows this sequence:
WindowsTerminal
fake key, which is mapped in kanata.kbd to(layer-while-held WindowsTerminal)
. This activated theWindowsTerminal
layer as the "active" layer while keeping thedefault
layer as the "base" layer.WindowsTerminal
fake key and presses theFirefox
fake key. As in 3, this must be mapped to(layer-while-held firefox)
.I imagine there will be some implementation challenges with e.g. handling errors if a layer doesn't have a corresponding fake key, keeping track of state so fake keys are released at the proper time, etc. To get the most out of this feature, it may be necessary to get Kanata to send a list of all fake keys.
As a plus, additional commands could be run when application focus changed, such as requested in #3. I foresee this being a really powerful feature. For example, you could have each fake key mapped something like:
(multi (layer-while-held layer-name) (cmd pwsh "'application-name: ' + (date +%s) >> application_timestamps.txt"
if you wanted to keep track of how much time you're spending each day in each app. You could run a command to automatically mute your mic when you defocus Teams. You could run a command to enable audio compression with EqualizerAPO when you activate Teams. With this feature, kanata_helper_daemon won't be restricted to just per-application layer changes - you can do whatever you want when the application changes!