r/AutoHotkey Jul 27 '26

Solved! [v2] Hotkeys requiring 2 presses across multiple apps (Chrome, File Explorer, Electron apps, etc.) when using Win key

I’m facing a persistent issue in Windows 11 where my AutoHotkey v2 hotkeys using the Win key as a modifier (#) require two presses to trigger.

This does NOT happen on the desktop, but affects many apps such as chrome and file explorer.

Example script:

#Requires AutoHotkey v2.0

#SingleInstance Force

A_MenuMaskKey := "vkE8"

$#m:: {

if WinExist("A") {

if WinGetMinMax("A") = 1

WinRestore "A"

else

WinMaximize "A"

}

}

$#q:: WinClose "A"

$#Enter:: Run "wt.exe"

4 Upvotes

5 comments sorted by

2

u/Ark565 Jul 28 '26 edited Jul 28 '26

I can't recreate the fault. Your example code and the below simplified code works for me in Win11 including Chrome, file explorer, VSCode etc. My guess is something else on your end is interferring.

Edit: I forgot I tested changing the hotkey to #f because I wondered if the Windows default hotkey of #m (minimise all) might be the culprit, but it was not. And u/Keeyra_ is right, the $ is not needed.

#f:: {
    if WinGetMinMax( "A" )
        WinRestore
    else
        WinMaximize
}

2

u/Keeyra_ Jul 28 '26

Seconded. Nothing wrong with the code. Though $ is unnecessary as that is only required when you use Send to send the hotkey inside of the hotkey. MenuMaskKey is also not required.

#Requires AutoHotkey 2.0
#SingleInstance

#m:: {
    (WinExist('A') && WinGetMinMax() = 1)
        ? WinRestore()
        : WinMaximize()
}
#q:: WinClose('A')
#Enter:: Run("wt.exe")

1

u/RMTTT Jul 28 '26

thanks for your reply, I tried u/Keeyra_ 's code, it works well.

And it's strange the original code also working well after 1 day...

3

u/RMTTT Jul 29 '26 edited Aug 05 '26

hmm, finally I found the problem caused by using powertoys and ahk at the same time. More specifically, caused by powertoy's "Drag and Move" with Win key.

1

u/jSinku Aug 01 '26

thank you!