-
Notifications
You must be signed in to change notification settings - Fork 153
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
Bug: passthrough with ahk not releasing shift while numpad lock is on #1487
Comments
Have you encountered this during regular typing? I've tried with and empty config (so no home row mods or anything else) and tried to overload LeftShift. I could only do that when I smash a lot of buttons together very fast and release Shift while the keys are still being buffered, and it doesn't seem to be kanata's fault - kanata reliably calls our AutoHotkey function that types via Maybe this is due to the fact that SI has to unhook before sending, this is a known issue with AHK, so not sure what to do. Or maybe this is caused by something else entirely, so even less sure ;) So I can think of only 2 potential workaround/fixes
Empty config tested
P.S. |
Here's what I got after a few days of testing in 3 different windows machines. All using the same windows, kanata and ahk versions mentioned above. Numlock 100% causes the broken config. I use numlock key presses to keep my work pc on so that's why I found out. Notes: With kanata passthrough, numlock key cannot be switched physically. WIth regular kanata.exe its possible
The config works fine on its own with kanata.exe and no ahk scripts running on all machines irrespective of numlock state. With numlock on: the shift key i.e. pressing
config: (defcfg
process-unmapped-keys yes
windows-altgr add-lctl-release ;; remove the lctl press that comes as a combo with ralt
)
(defsrc
esc caps a s d
f
h j k l grv ;; arrows and mirrored ctrl shift alt layer
i u o m ;; extra keys on arrow layer
)
(defvar
tap-time 1000
hold-time 1500
)
(defalias
esccaps (tap-hold-release $tap-time $hold-time caps caps)
capsescp (tap-hold-release $tap-time $hold-time esc esc)
a (tap-hold-release $tap-time $hold-time a lalt)
s (tap-hold-release $tap-time $hold-time s lsft)
d (tap-hold-release $tap-time $hold-time d lctl)
f (tap-hold-release $tap-time $hold-time f (layer-while-held arrows))
k (tap-hold-release $tap-time $hold-time k lctl)
l (tap-hold-release $tap-time $hold-time l lsft)
grv (tap-hold-release $tap-time $hold-time grv lalt)
)
(deflayer base
@esccaps
@capsescp
@a
@s
@d
@f h j @k @l @grv
i u o m ;; extra keys on arrow layer
)
(deflayer arrows
_
_
_
_
_
_ home left down right end
up Backspace enter Delete
) |
Nice, very interesting find! Have you tried with CapsLock on instead of NumLock? It seems to have a similar effect, though for simplicity I'm only testing with the blank config So maybe AHK's behavior on those Sends is somehow different when a lock is on? Though I don't know the internals of AHK to guess why that is...
The trace logs set log levels within Kanata, and since kanata behaves the same (it doesn't do key presses, just sends key info to ahk), they are supposed to be the same.
It can, just not with sleep(2)
SendInput('{vk90 down}')
sleep(2)
SendInput('{vk90 up}') so does |
With your config the shift key does NOT get stuck, although the other behavior is the same - with numlock on I only get left instead of select+left |
it's the same with regular AHK, sendinput doesn't work as a numlock substitute NumLock::{ ;
ToolTip "test." ;
SendInput('{vk90 down}') ; FAILS
}
NumLock Up::{
SendInput('{vk90 up}') ;
; SetNumLockState !GetKeyState("NumLock", "T") ; SUCCEEDS
ToolTip
} |
Strange, after getting that select+left my shift key is stuck until i manually press the physical shift key. Tested on 3 machines. Also, capslock and scroll lock key state doesn't break it either (as long as numlock is off) |
To clarify, shift is stuck while not using the keyboard. The homerow mod layer I also found some ahk issues regarding numpad shenanigans in windows but I'm not sure they're related, since the numpad isn't even being remapped here. https://www.autohotkey.com/docs/v2/KeyList.htm#numpad the .ahk debug logs at the line you mention are exactly the same messages with numpad lock on/off: if isSet(vk_hex) {
(dbg < _d) ? '' : (dbgtxt .= key_name " ahk←←←: vk=" kvk '¦' vk_hex ' @l' A_SendLevel ' → ' lvl_to ' ' hooks ' ¦' id_thread '¦ '
....
} |
I don't see any ahk shifts events in your log, those would tell you whether shift down/up events are passed by ahk via this log:
(this is using your config, so it's not physical shift, but your home row mod shift, which kanata translates to LShift and ahk sends as LShift and logs before doing so) Also you might want to fix unicode display otherwise it's harder to track ↓ vs ↑ So in my no-config test when I smash buttons, releasing the physical shift doesn't send Your logs should also show something. Maybe try to use the newer version of the AHK script in this repo and set |
Requirements
Describe the bug
Using the default configs at
https://github.com/jtroo/kanata/tree/main/docs/simulated_passthru_ahk
but with a very high timeout, the shift key will randomly become stuck and can only be released by tapping the physical shift key. This also happens in my own config with 150/300 tap/hold timeouts instead of 1000/1500 for multiple modifiers (shift, ctrl...)Relevant kanata config
As is https://github.com/jtroo/kanata/blob/main/docs/simulated_passthru_ahk/kanata_dll.kbd
To Reproduce
Expected behavior
Modifer keys should always be released
Kanata version
v1.8.0-prerelease-1
AHK version: 2.1-alpha.14
Debug logs
No response
Operating system
Windows 11 24h2
Additional context
No response
The text was updated successfully, but these errors were encountered: