DreymaR / BigBagKbdTrixPKL

"DreymaR's Big Bag of Keyboard Tricks" for Windows with EPKL
Other
346 stars 33 forks source link

AltGr causing Ctrl getting stuck with EPKL #25

Open Wiechciu opened 3 years ago

Wiechciu commented 3 years ago

Hello, This is a copy-paste from this post at Colemak forum. I have answered the questions at the end and added link to a gif example of the problem.

I have issues with AltGr causing Ctrl getting stuck during typing. I'm Polish and I use AltGr layer to type PL characters (regular Colemak + custom AltGr layer for PL characters). Issue is if I'm typing a bit faster (>50 WPM, so not even that fast), using AltGr to write a letter causes Ctrl to get stuck. With Ctrl getting stuck, when I continue to type and don't realize it happened, all hell breaks loose, because every shortcut ever is designed to be a "Ctrl + letter", so very quickly I have a page refreshed, 2 new tabs open and a printing menu ready to go.

@DreymaR, you mentioned in this post that it can get stuck when using the Extended layer. It is not the case, I have disabled that and use Caps Lock as Caps lock and Backspace as Backspace for some time now, and it didn't fix it.

This problem is the only thing that is frustrating to me to the point that I switched to MSKLC installed layout on my private PC, but I'm "unfortunately" stuck with EPKL on my business laptop, as IT didn't approve installing any new keyboard layout.

Is it possible to get it fixed, or find a workaround for it? I know I can use a layout that uses dead keys instead of going into AltGr layer for PL characters, but that would be the last option I would explore, as it interferes too much into the layout than I'm currently comfortable with (I tried that for some time and reverted back to regular Colemak + custom AltGr layer for PL characters).

Answering the questions from the Colemak forum post:

Firstly, have you tried downloading the very latest version of EPKL? I don't experience any stuck Ctrl with AltGr myself, now.

Yes, this is on the newest version downloaded yesterday.

Secondly, do you have an ANSI or ISO keyboard? Does the underlying Windows layout use AltGr or not?

It is ANS, Ducky One 2 Mini. The original Windows layout has an AltGr layer, e.g. in order to write "ą", I do AltGr+A. I have not experienced any issue with the Windows layout since I went back from EPKL to MSKLC on my private laptop.

In the newer versions of EPKL, Extend doesn't cause Ctrl to get stuck anymore that I know of. So if you wish to get back to the awesome power that is Extend, you should try it again.

Indeed seems like the Extend layer makes no difference here, getting stuck happens regardless.

See this gif that shows the problem, I was writing a word "mężczyźni", Ctrl got stuck on the "ź" letter, and what follows is letter "n", which ended up in me opening a new tab in Chrome with Ctrl+N shortcut.

Any help with the issue will be much appreciated! Thanks, Kuba

DreymaR commented 3 years ago

I see. I think you're right, using AltGr very rapidly may lead to trouble. I think I may have identified a possible culprit: Sticky RCtrl!

Try editing the EPKL_Settings_Default.ini file, removing ,RCtrl from the line with stickyMods =. That seems safer to me, hope it works for you!

Wiechciu commented 3 years ago

Hi, tried that and also tried removing the Sticky Mods lines completely and unfortunately still the same. See this GIF showing the same problem - it got stuck on "ą" and then tried to open the file with a shortcut CTRL+O. At the end of the recording I open the setting file to show you I have the sticky mods disabled. I can replicate this problem easily usually within 1 min of typing, sometimes takes a bit longer.

ghost commented 3 years ago

Hey,

I sometimes also experience the same issue that @Wiechciu described. Although my configuration is slightly different from his:

QWRCT = RCtrl   Modifier

This issue usually occurs when I press AltGr followed by Ext. key+\ in quick successions. Since it actually happens rarely to me (sometimes it doesn't happen for days), I haven't looked deeply into which key combination triggers the problems exactly. Refreshing EPKL either via keyboard shortcut or the menu option fixes it 100% of the time.

On a side note, I've got the feeling this is issue lays deeper than EPKL, and has something to do with AutoHotkey.

I will try to manually trigger it and test different EPKL configurations in the coming days to see if any changes bring some remedy. I'll report back if I find something.

DreymaR commented 3 years ago

The AltGr implementation is a bit messy. I think it's been that since PKL days. I've wanted to rework it completely for a long time. • Multi-Extend is cool! Shouldn't affect this. • My AltGr layer is a symbol layer, with dead keys. It's not instead of, it, can be both. • Without the RCtrl mapping, I don't think EPKL AltGr layers will work at all.

Hope this gets better, but right now I don't know quite how to. Interestingly, upgrading the AHK version makes EPKL AltGr go haywire, making Ctrl stuck on every press! So I'll definitely have to fix that key at some point....

DreymaR commented 3 years ago

Oh, actually... My last commit accidentally included a change I've been trying out. Instead of sending LCtrl+RAlt when the AltGr key is pressed, I send just the RAlt. Maybe you guys can try it out? I don't think it'll fix everything, but maybe it'll make the stuckness milder so that only AltGr itself gets stuck and not the Ctrl key!?

As always, if I do experience problems I try Ctrl+Shift+5 to refresh EPKL which often helps. But I have noticed some cases of trouble after pressing AltGr+key quickly, myself. I'll keep looking for solutions!

DreymaR commented 3 years ago

@Wiechciu The very latest EPKL commit includes a change that sends a LCtrl Up shortly after each AltGr press! This should hopefully both avoid menu line activation (upon sending RAlt alone without LCtrl), and your stuck LCtrl problem. Please try it out!

Wiechciu commented 3 years ago

Hi @DreymaR Unfortunately still works the same on the new version. I can reproduce it within 1-2 mins of typing. Let me know if I can provide you with any data to find the rootcause of this issue.

Wiechciu commented 3 years ago

Hi @DreymaR again, I have found this tool which is essentially a web-based keylogger. I have managed to replicate the stuck Ctrl with this tool. See this image with the full log. You can see at the end it got stuck on "ż", and the last recorded keystroke is CTRL+E which brought me to the chrome's search bar.

This also shows a bit weird behaviour at the end - keydown at #10103 was "z" while keyup #10104 was "ż". This is not the case with other AltGr letters written before like "ł" at #10076 and #10077. Maybe that has something to do with it getting stuck.

I have also noticed that everytime I hit AltGr+letter, there's an additional Ctrl sent after I release the key - not sure if that's intended? E.g. #10080 #10081, also #10034 #10035 and many other places before that. This happens also with the older version of the EPKL, so it was there before, it is not added with this new version.

When I tried the test with EPKL disabled, using my original MS Windows layout, the input for AltGr letters is much simpler. See here my test writing the same word "mężczyźni" using MS Windows layout with only 26 events vs EPKL with 44 events. I know it probably can't be as simple as original MS Windows layout, but wanted to point that out as a potential rootcause of this problem.

Let me know if I can help in any way.

DreymaR commented 3 years ago

@Wiechciu Thanks for the useful links and analysis! I'm still somewhat stuck on this issue, but I finally feel that we're approaching an answer...

For your information, you can also see the AutoHotkey key log by the EPKL menu choice "AHK Key History...". It complements the Keyboard Event log tool you found somewhat, telling you what's real/hardware (h) and generated (i) key presses and a little more accurately what their timing is.

Turns out that every active modifier whether Shift or LCtrl+RAlt=AltGr is sent as a key up before the character is sent and then resent down and up afterwards, which is unnecessary and may create our problem. It is a property of the AutoHotkey Send routine itself. If I send {Blind} this doesn't happen but then the AltGr layer doesn't work at all instead.

I'll look further into it, but this issue is confusing... ୧( x﹏x)୨

DreymaR commented 3 years ago

Okay... Maybe this will help! I used the AHK v1.1.27 Send {Text} mode for sending single characters, which avoids the extra LCtrl DownLCtrl Up pair. It still sends a LCtrl+RAlt Down/Up after each sent character, but I'm hoping that wasn't the problem. Please try out the latest commit and give feedback on it.

Wiechciu commented 3 years ago

Hi @DreymaR, I just took a couple minutes of tests on monkeytype and it hadn't got stuck even once. Previously, I would have it stuck already a couple of times within that timeframe. Seems like that last fix actually did it :). It either fixed it completely, or drastically decreased the chance of it happening.

I will switch to 100% EPKL now, so I can test it more thoroughly. I will give you some more feedback next week as I'll not be home nor will I be working for the rest of the week.

You're amazing dude, have a good one!

teddympq commented 6 months ago

This issue still happens when using System Layout or VK. eD and eD2VK are fine. What could I do?

teddympq commented 5 months ago

Ok, from what I've read, I assume there is no practical way to solve this without sending artificial text using Send {Text}. This is also mentioned in the TODO list. I am using System Layout over a Colemak CAWS msklc. ( ಥ╭╮ಥ)