Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send only if key was pressed alone

Tags:

autohotkey

I'd like to remap my windows key to something else, but also I'd like to keep all windows key based shortcut.

In pseudo code it would be something like this:

when LWin Down until LWin Up if not LWin down abort else execute command

like image 698
Nicolas Goy Avatar asked Dec 06 '25 10:12

Nicolas Goy


1 Answers

Release the left windows key within 0,3 seconds after pressing it, to do something else (e.g. to send a):

~LWin::
KeyWait, LWin
return

~LWin Up::
Send {LWin Up}
If (A_PriorHotKey = "~LWin" AND A_TimeSincePriorHotkey < 300)
    Send, a
; else  ; another action after long press (not recommendet)
    ; Send, b
return

EDIT:

Try also this:

LWin up::
If (A_PriorKey = "LWin")
    Send a
return

; In this case its necessary to define a custom combination by using "&" or "<#" 
; to avoid that LWin loses its original function as a modifier key:

<#d:: Send #d  ; <# means LWin
like image 54
user3419297 Avatar answered Dec 09 '25 00:12

user3419297



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!