Search code examples
autohotkeymultiple-monitors

How can I maximize a window across multiple monitors?


Using AutoHotkey, How can I bind a hotkey to stretch/maximize/span a window across multiple monitors so that it covers both displays?

Right now, I have to do this by manually stretching the windows with the mouse. I know there are dedicated tools that do this, but I'm already running an AutoHotkey script and would rather limit the number of tools I keep running.


Solution

  • Here's how I did it, mapping the Shift + Windows + Up combination to maximize a window across all displays. This compliments Windows 7's Windows + Up hotkey, which maximizes the selected window.

    AHK v1
    +#Up::
        WinGetActiveTitle, Title
        WinRestore, %Title%
       SysGet, X1, 76
       SysGet, Y1, 77
       SysGet, Width, 78
       SysGet, Height, 79
       WinMove, %Title%,, X1, Y1, Width, Height
    return
    
    AHK v2
    +#Up::
    {
        Title := WinGetTitle("A")
        WinRestore(Title)
        X1 := SysGet(76)
        Y1 := SysGet(77)
        Width := SysGet(78)
        Height := SysGet(79)
        WinMove(X1, Y1, Width, Height, Title)
    }