This tiny addon opens the game menu (bound to the "Escape" key by default) in one press. With this, you will only have to press "Escape" once to open the game menu even if you have a target, are casting a spell, or have another menu open. It does this by tracking whether the game menu is open and toggling the game menu's visibility with that state every time the game menu bind is pressed. Here's the code:
local gameMenuWasShown = GameMenuFrame:IsShown()
local function updateWhetherGameMenuWasShown()
gameMenuWasShown = GameMenuFrame:IsShown()
end
hooksecurefunc("ToggleGameMenu", function()
PlaySound(gameMenuWasShown and SOUNDKIT.IG_MAINMENU_QUIT or SOUNDKIT.IG_MAINMENU_OPEN)
GameMenuFrame:SetShown(not gameMenuWasShown)
updateWhetherGameMenuWasShown()
end)
MainMenuMicroButton:HookScript("OnClick", updateWhetherGameMenuWasShown)
This addon was previously able to fully replace Blizzard's ToggleGameMenu function, allowing opening the game menu without cancelling a spell cast or dropping target, but it's no longer able to do that because Blizzard restricted the ToggleGameMenu function. An addon which adds a new separate keybind for toggling the game menu directly may be possible, but this isn't it (yet).