Skip to content
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

EPKL Does Not Work With Password Manager Auto Type #54

Closed
Jackabomb opened this issue Nov 22, 2022 · 7 comments
Closed

EPKL Does Not Work With Password Manager Auto Type #54

Jackabomb opened this issue Nov 22, 2022 · 7 comments
Labels
answered Guru covered (most of) the issue question Good question! (Θώθ )

Comments

@Jackabomb
Copy link

Jackabomb commented Nov 22, 2022

Awesome software, thank you! It allows me to try Colemak at work where I don't have admin privileges.

I noticed, however, that my password manager's auto type (KeePass 2) has broken.
For example, instead of jackabomb, it types naceabymb.

jackabomb <- expected
naceabymb <- gotten

naceabymb is, coincidentally, what you get if a QWERTY user tries to type jackabomb on Colemak.

Sure enough, AHK history reveals KeePass attempting to use QWERTY and AHK interfering doing its job.
Unless otherwise noted, type i events are AHK while type h events are KeePass.

VK SC Type Up/Dn Elapsed Key Window Notes
4A 024 h u 0.00 j Keepass. We just missed the very start of the auto type
4E 031 i d 0.01 n AHK
4E 031 i u 0.00 n
41 01E h d 0.03 a
41 01E h u 0.00 a
41 01E i d 0.01 a
41 01E i u 0.00 a
43 02E h d 0.03 c
43 02E h u 0.00 c
43 02E i d 0.02 c
43 02E i u 0.00 c
4B 025 h d 0.03 k
4B 025 h u 0.00 k
41 01E h u 0.02 a Me, releasing the hotkey that triggered the auto type (Ctrl+Alt+A)
45 012 i d 0.00 e
45 012 i u 0.00 e
A4 038 u 0.02 LAlt Me, releasing the hotkey that triggered the auto type (Ctrl+Alt+A)
41 01E h d 0.01 a
41 01E h u 0.00 a
A2 01D u 0.00 LControl Me, releasing the hotkey that triggered the auto type (Ctrl+Alt+A)
41 01E i d 0.02 a
41 01E i u 0.00 a
42 030 h d 0.03 b
42 030 h u 0.00 b
42 030 i d 0.02 b
42 030 i u 0.00 b
4F 018 h d 0.03 o
4F 018 h u 0.00 o
59 015 i d 0.02 y
59 015 i u 0.00 y
4D 032 h d 0.03 m
4D 032 h u 0.00 m
4D 032 i d 0.01 m
4D 032 i u 0.00 m
42 030 h d 0.03 b
42 030 h u 0.00 b
42 030 i d 0.01 b
42 030 i u 0.00 b
74 03F h d 2.97 F5 C:\Users\xxxxxxx\Downloads\EPKL_Executable_v1-4-0\EPKL.exe Me, updating the AHK history
74 03F i d 0.02 F5 Me, updating the AHK history

If I turn off EPKL, this is the output. We can see the whole invocation this time.
Interestingly, I get the same (correct) result if I switch the Windows layout to Dvorak (with EPKL still turned off). This suggests that KeePass detects the active keyboard layout and adjusts accordingly. Indeed, their web site warns

KeePass does not know the keyboard layout that has been selected in a remote desktop or virtual machine window. If you want to auto-type into such a window, you must ensure that the local and the remote/virtual system are using the same keyboard layout.

KeePass Auto-Type Requirements and Limitations
This supports the idea that they do know the layout normally.

VK SC Type Up/Dn Elapsed Key Window Notes
A2 01D d 3.20 LControl TypeRacer - Play Typing Games and Race Friends - Google Chrome Me, invoking auto type
A4 038 d 0.08 LAlt Me, invoking auto type
A4 038 d 0.50 LAlt Me, invoking auto type
A4 038 d 0.03 LAlt Me, invoking auto type
A4 038 d 0.05 LAlt Me, invoking auto type
A4 038 d 0.03 LAlt Me, invoking auto type
A4 038 d 0.03 LAlt Me, invoking auto type
A4 038 d 0.03 LAlt Me, invoking auto type
A4 038 d 0.03 LAlt Me, invoking auto type
A4 038 d 0.03 LAlt Me, invoking auto type
A4 038 d 0.03 LAlt Me, invoking auto type
A4 038 d 0.03 LAlt Me, invoking auto type
A4 038 d 0.05 LAlt Me, invoking auto type
A4 038 d 0.03 LAlt Me, invoking auto type
41 01E d 0.02 a Me, invoking auto type
A2 01D a u 0.01 LControl Me, invoking auto type
A4 038 a u 0.00 LAlt Me, invoking auto type
4A 024 a d 0.02 j
4A 024 a u 0.00 j
41 01E a d 0.05 a
41 01E a u 0.00 a
41 01E u 0.03 a
43 02E a d 0.02 c
43 02E a u 0.00 c
A4 038 u 0.01 LAlt
4B 025 a d 0.02 k
4B 025 a u 0.02 k
A2 01D u 0.01 LControl
41 01E a d 0.02 a
41 01E a u 0.00 a
42 030 a d 0.05 b
42 030 a u 0.01 b
4F 018 a d 0.03 o
4F 018 a u 0.01 o
4D 032 a d 0.03 m
4D 032 a u 0.00 m
42 030 a d 0.05 b
42 030 a u 0.00 b
74 03F d 1.55 F5 C:\Users\xxxxxxx\Downloads\EPKL_Executable_v1-4-0\EPKL.exe Me, refreshing AHK history

So. I'm not even convinced this is a bug in EPKL or KeePass. Perhaps it's merely an unfortunate point of incompatibility, but I'd appreciate any thoughts or ideas on the subject, or any possible workarounds. For the moment, I just switch layouts in EPKL when I need auto type, but that is inconvenient.

Thanks again! 😃

P.S. Yes, this took like an hour to compose. 75% drop in speed hurts so bad... 😭 Ah, the agony of switching layouts!

@DreymaR
Copy link
Owner

DreymaR commented Nov 23, 2022

Interesting! No, it doesn't count as a bug on either side but it is a delicate interaction.

You can of course suspend EPKL by hotkey whenever you want to use KeePass. Or even make EPKL auto-suspend by active program and/or web page, if that helps. But it doesn't sound like a complete solution.

The issue is that KeePass really does its thing, hard core. EPKL doesn't work in some password windows because they don't respect its i (inserted) events to keep things safe. KeePass circumvenes this problem by sending actual "physical" h (hard) events. Respect. But this makes EPKL capture and remap its output (or maybe it's the other way around, idk) – uh-oh...

It's theoretically possible to make passwords for yourself that are layout agnostic. But I can't recommend that too loudly, as it will reduce the number of available keys for passwords by quite a few which means a bit less security. What I can say however, is that actual password security correlates more with password length than with human-perceived complexity!

On a side note: If writing a long post takes too much of your time, you could try a Tarmak transition? But now that you've started with the cold-turkey approach I guess you'll want to continue with that.

@DreymaR DreymaR added the help wanted Help me, Obi-Wan! label Nov 23, 2022
@zoidy
Copy link

zoidy commented Sep 13, 2024

To work around this issue, I have modified the EPKL source to hijack some of the built-in hotkeys to disable and enable EPKL. Then I added those hotkeys to the KeePass autotype sequence to disable EPKL and enable it again as soon as it's done typing.

I realize EPKL has an existing hotkey to toggle enabling disabling but toggling isn't what's needed when using KeePass to control EPKL's state.

In pkl_init.ahk, I commented out the lines for hotkeys I won't use
pklSetHotkey( "moveImageHotkey"....
and
pklSetHotkey( "epklDebugHotkey"....

And added two new keys
pklSetHotkey( "disableEPKLHotkey", "suspendOn" , "")
pklSetHotkey( "enableEPKLHotkey", "suspendOff" , "")

In the settings override file I added
disableEPKLHotkey = ^+9
enableEPKLHotkey = ^+=

My autotype sequence in KeePass looks like
^+9{USERNAME}{TAB}{PASSWORD}^+=

@Jackabomb
Copy link
Author

@zoidy Thanks! I'd forgotten about this issue. I just got in the habit of turning EPKL off by hotkey, but your solution looks pretty nice. Can you explain what's wrong with the existing hotkeys though? I don't understand what you mean about toggling vs. enabling/disabling, and that not working with KeePass.

2 years in and I'm still rocking Colemak, still loving EPKL. The Caps-Mod shortcuts have become second nature to me. I miss them so much when I use another keyboard.
P.S. I did get most of my old speed back. (Lower accuracy, and having to redo mistakes, is still holding me back.)

@zoidy
Copy link

zoidy commented Sep 14, 2024

Can you explain what's wrong with the existing hotkeys though? I don't understand what you mean about toggling vs. enabling/disabling, and that not working with KeePass.

TL DR; using the built-in toggle shortcut in the autotype sequence is probably fine for most

I suppose that's specific to my use case. I usually have EPKL enabled but sometimes disable it when I undock my laptop (never really got used to the different layout on a smaller keyboard). In that case, if one adds the toggle that comes with EPKL to the KeePass autotype sequence (^+3 is the EPKL default I think), it assumes that EPKL is already enabled. If EPKL is disabled, triggering the toggle will enable it, which is not what we want for KeePass autotype. (yes it will become enabled at the end of the sequence, so I suppose it cancels the benefit; I usually don't undock anymore so maybe I will switch to using the toggle for simplicity)

@DreymaR
Copy link
Owner

DreymaR commented Sep 14, 2024

Tell me though... Does KeePass use its own window? Because if it does, then you could just use EPKL's built-in Auto-Suspend to disable EPKL whenever the KeePass window is active. There's even an EPKL hotkey (epklDebugHotkey, default Ctrl+Shift+0, mentioned by Zoidy) that you can use to detect program data to enter in the settings for Auto-Suspend. If KeePass does get an active/in-focus process, try it out.

Regarding Zoidy's resourceful solution, I don't get why you couldn't just change the EPKL Suspend hotkey to ^+9 in the Settings instead of modifying source code. Maybe I'm missing something?

Ah, it's because you don't want the toggle but explicit on and off hotkeys. I see. Yes, you did explain it. I need more coffee, hehe. But as you imply, that'd be too complex for most users. Glad you figured that one out then, you smartie, you!

 ̄(=⌒ᆺ⌒=) ̄

@zoidy
Copy link

zoidy commented Sep 15, 2024

Tell me though... Does KeePass use its own window? Because if it does, then you could just use EPKL's built-in Auto-Suspend to disable EPKL whenever the KeePass window is active. There's even an EPKL hotkey (epklDebugHotkey, default Ctrl+Shift+0, mentioned by Zoidy) that you can use to detect program data to enter in the settings for Auto-Suspend. If KeePass does get an active/in-focus process, try it out.

That would have been the cleanest solution. Unfortunately, the way autotype works is that the the window that is being autotyped into has to have the focus

DreymaR added a commit that referenced this issue Sep 16, 2024
* Added explicit Suspend On/Off HKs
* Unlike the toggle, not used by default
* Useful, e.g., with KeePass autotype
* See EPKL Issue fix #54
@DreymaR
Copy link
Owner

DreymaR commented Sep 16, 2024

Okay, so I did this:

Added two new hotkeys: doSuspendHotkey (ON) and unSuspendHotkey (OFF). These aren't set by default, but can be set in the Settings file or, preferably, its override. If you do use the override file, remember to deactivate any hotkeys you take over by setting them to --.

So that means you can now do your KeePass trick for suspending EPKL, without editing the EPKL source code.

Thanks, @zoidy, for discovering this fix!

@DreymaR DreymaR added question Good question! (Θώθ ) answered Guru covered (most of) the issue and removed help wanted Help me, Obi-Wan! labels Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered Guru covered (most of) the issue question Good question! (Θώθ )
Projects
None yet
Development

No branches or pull requests

3 participants