Keyboard shortcut for moving a window to another screen

Posted by wcoenen on Super User See other posts from Super User or by wcoenen
Published on 2009-10-29T15:23:17Z Indexed on 2011/11/24 18:00 UTC
Read the original article Hit count: 178

When working with two (or more screens), a common problem is that launched applications appear on the "wrong" screen. I especially find this annoying when launching a text editor from the command line, because I have to leave the home row with my right hand in order to drag the window to the "right" screen before I can continue typing.

Is it possible to define a keyboard shortcut which moves the current application to the other/next screen?

Edit: I'm using Windows XP, but it's good to know that the feature already exists in Windows 7.


Edit2: I went for the autohotkey script. This adaptation works for me:

#q::
WinGetPos, winx, winy,,, A
WinGet, mm, MinMax, A
WinRestore, A
If (winx > 1270)
{
    newx := winx-1270
    OutputDebug, Moving left from %winx% to %newx%
}
else
{
    newx := winx+1270
    OutputDebug, Moving right from %winx% to %newx%
}

WinMove, A,, newx, winy

if mm=1
    WinMaximize, A
Return

I did have to make use of the OutputDebug statements and dbgview to discover the proper threshold value 1270 for moving left or right. The exact threshold is especially important when moving maximized windows to the left.

© Super User or respective owner

Related posts about windows-xp

Related posts about keyboard-shortcuts