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

Remapping keys like "Windows" #43

Open
guraltsev opened this issue Jul 30, 2022 · 1 comment
Open

Remapping keys like "Windows" #43

guraltsev opened this issue Jul 30, 2022 · 1 comment

Comments

@guraltsev
Copy link

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
Copy link
Owner

DreymaR commented Aug 29, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants