0
votes

Summary: I need to press and hold LAlt key without closing the "right click menu".


I am using my left alt key as a second layer activation key for a 60% keyboard (no arrows cluster).

It's working wonders for my typing and programming usage but I have one small problem with my mapping: when I press the LAlt key, it triggers some internal action on the system that closes the right-click menu and I cannot navigate through the options using my LAlt + keys combination.

How to reprocuce:

  • right click anywhere (or press the AppsMenu key) to open the "right click menu";
  • press AND HOLD the left all key.

Expected behavior: the menu would keep open.

Current behavior: the menu closes.

You will notice that on key down (before release) the menu will close. Since I am using the LAlt key to press arrow keys, I cannot navigate on the menu because it closes as soon as I try to press my key combination to move the selection (LAlt + k for "down arrow").

I tried LAlt::Return and some other combinations but to no avail, it always trigger the system default function (closes the menu) on key down, but my AutoHotKey script only triggers on key up. Even when I have both LAlt:: and LAlt Up::, they both triggers on key up and I have no way of controlling the key down behavior to cancel it.

Any ideas?

2

2 Answers

3
votes

Make sure you don't forget to setup the #UseHook directive.

#NoEnv
#UseHook
LAlt:: return

That works fine for me.

0
votes

Ah, I struggled with exactly the same issue for quite a while. Strange I didn't find this question before.

*LAlt::Send {Blind}{RCtrl DownR}  ; I remapped my 'LAlt' as 'RCtrl'.
*LAlt Up::
If (A_PriorKey == "LAlt")
    Send {Escape}                 ; As extra it sends 'Esc' when pressed by itself.
Send {Blind}{RCtrl Up}
return

I don't create any hotkeys with LAlt. Instead I use GetKeyState() with an #If directive.

#If GetKeyState("LAlt", "P")

*k::
If GetKeyState(";", "P")   ; Semicolon key acts as an extra 'Shift'
  Send +{Down}             ; for easy selections.
else Send {Down}
return

*+k::Send +{Down}

... etc ...

#If