Skip to content

Instantly share code, notes, and snippets.

@aqt
Created August 26, 2021 17:05
Show Gist options
  • Save aqt/b681c7b59b80fd8df45445dc7d291a39 to your computer and use it in GitHub Desktop.
Save aqt/b681c7b59b80fd8df45445dc7d291a39 to your computer and use it in GitHub Desktop.
Firefox disables maximization on popup window types, this autohotkey script re-enables that functionality
#Persistent
Gui +LastFound
shellMessage(wParam, lParam) {
if (wParam = 1) { ; HSHELL_WINDOWCREATED
hWnd := lParam
WinGetClass, winClass, ahk_id %hWnd%
if (winClass = "MozillaDialogClass") {
Sleep, 200 ; Quick fix, no effect if too fast
WinSet, Style, +0x10000, ahk_id %hWnd%
}
}
}
DllCall("RegisterShellHookWindow", UInt, WinExist())
hook := DllCall("RegisterWindowMessage", Str, "SHELLHOOK")
OnMessage(hook, "shellMessage")
@aqt
Copy link
Author

aqt commented Aug 26, 2021

Disclaimer that I'm not at all familiar with WinAPI.

I threw in a sleep because there was no effect if reacting too fast to the "window created" message. There's no particular reason for choosing 200ms, if it doesn't work for you try increasing this value. According to the docs the message is sent when the widow exist, but perhaps style hasn't been set at that time? In which case there might be a better message to listen for. Another possibility is that Firefox manipulates it after creating the window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment