DreymaR / BigBagKbdTrixPKL

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

Remapping keys like "Windows" #43

Open guraltsev opened 2 years ago

guraltsev commented 2 years ago

Hello,

First of all, I would like to thank you for this great software! It is true that it is quite complex and scary at first but yesterday I mustered up the courage to switch from the windows layout manager to using this program. I will not go back!

I was already using a small AHK script to remap tapping the LWin key to issuing a shortcut. Normally on Windows, if you tap the LWin key it opens the start menu. Then if you start typing it starts searching for a program. However, there are much better launchers than the start menu e.g. https://keypirinha.com/. One cannot bind to the tap of the 'LWin' key directly (thank you Microsoft for your usual monopolistic behavior ). So the following AHK script detects "pure" LWin keypresses and sends out a shortcut Alt+Space if LWin was pressed alone

#NoTrayIcon
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
#InstallKeybdHook
#UseHook
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

; If windows key gets pressed alone then send alt-space
LWin up::
If (A_PriorKey = "LWin") ; LWin was pressed alone
    Send, ^!w
return

; But still make LWin have its original function 
<#d:: Send #d  ; <# means LWin

Could such functionality be included in your program, i.e. remapping the LWin key and not using it as a modifier?

Apart from this suggestion I have the following question/issue. My script is actually in slight conflict with EPKL: It cannot detect "purity" of the keypress. I have the shortcut LWin+` to open a drop-down terminal. Before, pressing that shortcut did not trigger the AHK script. With EPKL, however, the logic does not work anymore, and even if I press LWin+` it sends out the shortcut on the release of the LWin key. Any suggestions?

Thank you!

DreymaR commented 2 years ago

To implement such functionality, it'd currently be necessary to hardcode each hotkey into the EPKL source code. That's beyond the scope of EPKL.

To my knowledge, EPKL doesn't do anything with the Win key. I'm generally wary of messing with the modifier keys as the results are often unpredictable and not robust.

Be aware that running other key-hooking scripts together with EPKL is, as described in the README, not robust. Hook competition between scripts makes it uncertain which script gets control over which key. Again, you'd have to merge your script with EPKL's source to make this work. Unfortunately, I haven't had success with making such merges when I tried it.