Open oblitzitate opened 5 months ago
To help justify this feature, it would be good to measure the CPU time difference between the runtime evaluation of
(defalias
lft (switch
((layer alt-layer)) (unmod left) break
((layer one-shot-navigation-layer)) (multi left @virtual-one-shot-navigation) break
() left break
)
)
vs its the worst-case time difference:
(defalias
lft left
)
Is your feature request related to a problem? Please describe.
I issued a feature request to allow to check the active
layer
inside aswitch
, which got merged. Now while I liked that you can use it to reduce the amount of aliases you need, I disliked that it added a bit of run-time logic via layer checks. So I figured why not have a feature that can reduce both: compile-time conditional mappingsDescribe the solution you'd like.
With such a feature, you'd be able to define what a key does at compile-time:
Under the
comptime
context,switch
only allows compile-time conditions (e.g. layer, window manager, OS, hardware keyboard model, etc.). If you want, you can use another keyword likecond
instead ofswitch
to differentiate it from the run-time version.Now given the following...
...when kanata starts, it would check the layers in which
@lft
is mapped. Instead of keeping theswitch
logic at run-time,@lft
will be converted to the following:That way, you reduce the amount of aliases you need without the cost of unnecessary run-time logic.
Describe alternatives you've considered.
Using
switch
withlayer
checks.Additional context
No response