Closed sdeken closed 3 hours ago
Changes on master in pursuit of v0.9.9 / #182 seem to have fixed this, mostly. It's down to one or two ghost keystrokes, from "many" (which I have also observed many times 😞)
I suspect [NSApp activateIgnoringOtherApps:YES];
may be the culprit, but more testing is needed!
Hmm, maybe it's not fixed after all, I'm still seeing this behavior in some circumstances and it's not clear why.
The issue is still here and, from my experience, it's been present for as long as I've been using KeyCastr. No special steps needed to replicate on my end: 1) Open TextEdit, 2) Open KeyCastr, 3) Type something in TextEdit, 4) Close KeyCastr ( either via r-click in the dock or by focusing the app and pressing CMD+Q ), 5) TextEdit will receive a random number of the previously typed keystrokes. Attaching a video with the replication.
One weird thing though is that it never seems to repeat the very first keystroke 🤔
https://github.com/user-attachments/assets/568854c6-e75d-4fcf-b864-66de7da2c311
Looks like there's an issue in which keystrokes are being "held" by KeyCastr and broadcast into other applications when shutting KeyCastr down.
To recreate:
Expected Result: KeyCastr shuts down and the empty note in Notes is still empty.
Actual Result: The gibberish that was typed (some, but not all) is put into the empty note.
This appears to be caused by the initial keyboard tap that we create to check whether or not we can listen for the kCGEventKeyDown event. If we skip this check, the problem goes away.