Skip to content

Instantly share code, notes, and snippets.

@josefandersson
Created February 1, 2020 03:14
Show Gist options
  • Save josefandersson/1e6259332e08adad727ba587fdf310de to your computer and use it in GitHub Desktop.
Save josefandersson/1e6259332e08adad727ba587fdf310de to your computer and use it in GitHub Desktop.
Move open windows from one monitor to the other on dual monitor setups
WinGet, windows, List
Loop %windows%
{
id := windows%A_Index%
WinGetPos, x, y,,, ahk_id %id%
WinGetTitle, wt, ahk_id %id%
StringLen, tl, wt
If tl > 0 And WinExist("ahk_id" . id)
{
If x < -8
{
WinMove, ahk_id %id%,, x+1920, y
}
Else
{
WinMove, ahk_id %id%,, x-1920, y
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment