Closed jtroo closed 1 year ago
@riotrah I've done some testing on this using configuration with the llhook mechanism.
(defcfg process-unmapped-keys true)
(defsrc
7 8 9 0
caps
)
(deflayer base
_ _ _ _
(tap-hold-press 200 200 caps (layer-while-held layer))
)
(deflayer layer
C-S-A-M-b C-S-A-M-a C-S-A-M-c C-S-A-M-k
_
)
I haven't been able to create any strange or incorrect behaviour so far. Are there specific key combinations that are triggering the bug?
Additional reproduction info would be great 🙂
I've changed nothing about my computer usage, yet I haven't actually repro'd it since that first day I was setting it up 🤷.
My computer happened to be a lil sluggish as I was rendering a bunch of audio files at the time. Perhaps there's some mistiming issue or something when under load? Couldn't begin to guess.
So I perused kmonad
s repo for tips on running at startup. I couldn't find much relevant info I guess because keyword search is hard in popular projects, but I did see a couple of issues about stuck keys.
I wish I copied the urls but I didn't and couldn't find them again easily. However, it looks like there are a couple of cases that might trigger a stuck key , modifier or otherwise.
Having the modifier keys held down while Kanata starts, or perhaps lrld
s
Having Kanata emit a modifier before Windows locks or sleeps or something, and then reactivating windows, thereby keeping the press - because no release event was emitted, the keys stayed held down
Just for some context, and for visibility, I'll repeat something I mentioned in a different issue. In my perusing, others have encountered a similar issue without using kanata. I've seen someone say it's happened to them when using only AHK; they weren't a kanata user.
So it seems like the issue is not directly related to kanata; it's something to do with the hook mechanism and/or SendInput.
I'm not familiar with win32 APIs (though at this point I suppose it wouldn't hurt to learn), so to clarify:
"the hook"/llhook
refers to this windows keyboard "hook" - which I gather from its mentions in AHK, Kanata, powertoys and kmonad, and from the intense frustration many have with interception
which suggests it's the only other real alternative, is the only API with which one can implement really "robust" key remapping on windows
I'm not at my PC but SendInput is the AHK flag to utilize the hook as opposed to some other method, correct?
That all makes sense. I suppose I could have just as easily googled that.
And it increasingly appears that in the similar cases seen so far, AHK might be the thing responsible for setting these pressed states as far as the hook is concerned. Then somehow Kanata and AHK start overlapping or conflicting somehow at which point "no one" is able to communicate any subsequent releases to the hook.
I guess what I don't get, is:
Why I'm able to unstick keys in AHK by tapping them again, yet the memorable last time I had this issue, tapping didn't unstick them. Perhaps there was some conflict between the two apps?
If so, I'm wondering why it hasn't happened since. I've been using both at once to great effect, and it's likely many of the same conditions from when things got messed up reoccurred. Certainly the same config is in place 🤔
Either way, I suppose this bug is resolved for now for me. Thanks for the update!
Let's leave this ticket open for visibility.
For reference:
Testing hyper-modded keys in a layer:
As I was testing this out, kanata entered a borked state, where:
At rest/in the default layer without any toggles etc:
hyper
counterpartsa
becomesS-C-M-A-a
and so ona
, egctrl
+a
still emitsS-C-M-A-a
etchjkl
keys that I'd defined as the arrowsYet holding down capslock:
hjkl
keys as arrows, and add any modifiers as desired, and it works as configuredhjkl
keys still emit their all-modifiers combos (technically correct per config)But thus I'm in some kind of unusable hybrid state of the default qwerty I have and the new
hyper
layer!invoking
lrld
did indeed reload according to my terminal, but it didn't unbork this statethis weird state in fact occurred as I was trying to write this very comment
I couldn't terminate kanata in my terminal either, as
ctrl-z/c
emitted their all-modifiers versions no matter what modifiers I'd addedI'd encountered this state before with AHK, and the fix was to simply tap each modifier key once to 'unstick' them, but this did not work here
I thought I was stuck like this until a reboot or something, but at some point, perhaps after a sequence of mashing various modifiers and triggering
lrld
several times, and it fixed itselfAny clue what might have happened or something to try to prevent or escape from it in the future?
Also, more usage questions, apologies if I'm getting annoying:
L
), plusWin
, instead of (or in addition to) emittingWin
+Right
(eg for moving the active window to the right), it locks Windows. That is, it fails to override the windows hotkey ofWin
+L
for Lock. Would the interception driver solve this, or running kanata as admin, or something else?Originally posted by @riotrah in https://github.com/jtroo/kanata/discussions/185#discussioncomment-4142758