Keyboard shortcut for moving a window to another screen

78,349

Solution 1

Autohotkey! This'll move between the monitors (two 1680x1050 monitors, set the value after Loop, to be each monitor's screen resolution/10 if you're different) on winkey (#) and q. Control is ^, alt is !, shift is +, and letters are letters. You can use combinations of the modifiers, too.

#z:: ;Move the active window to the other monitor.
WinGetPos, winx, winy,,, A
WinGet, oldWin,ID,A
WinActivate, A
WinGet, mm, MinMax, A
WinRestore, A
If winx+5 >= 0 then
    mult=1
else
    mult=-1
WinMove,A,, winx-(1680*mult), winy
if mm=1
    WinMaximize, A
Return

Solution 2

What version of Windows are you using? Windows 7 comes with native support for exactly this.

Win+Shift+left: Move focussed window one monitor to the left

Win+Shift+right: Move focussed window one monitor to the right

EDIT: For XP you could try out UltraMon. Amongst other things it will allow you to define hotkeys for "Move window to next monitor" and "Move window to previous Monitor".

Solution 3

in other versions of windows, you can right click on the taskbar, select "move" and then use the arrow keys to move the window across to the correct window... I only mention this because every now and then, I accidentally leave a window on the wrong monitor and then when I use my laptop at home, I can't see the window because it's off monitor. Took me a while to figure this out!

Solution 4

If you don't have Windows 7, you may want to try DisplayFusion. The free version allows you to configure hotkeys to move windows to the next monitor, and several other goodies.

Share:
78,349

Related videos on Youtube

BruceBerry
Author by

BruceBerry

You can contact me at [email protected].

Updated on September 17, 2022

Comments

  • BruceBerry
    BruceBerry over 1 year

    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.

  • Ivo Flipse
    Ivo Flipse over 14 years
    I feel like a newb for not knowing that +1
  • sYnfo
    sYnfo over 14 years
    Off topic, but how did you make those "buttons"?
  • Ville M
    Ville M over 14 years
    @sYnfo wrap the "button" in a <kbd></kbd> tag
  • Pauk
    Pauk over 14 years
    +1, thanks for that. I was using Ultramon previously, no longer need it with this.
  • UNK
    UNK over 14 years
    Ultramon is expensive, but IMO well worth the price.
  • BruceBerry
    BruceBerry over 14 years
    This is promising, but the loop is really slow. The window crawled over my desktop at a snail's pace :-)
  • BruceBerry
    BruceBerry over 14 years
    The script also moves the window under the mouse pointer, instead of the currently active one.
  • UNK
    UNK over 14 years
    Whoops! I have it on mouse 4 and double click, so under mouse is better for me, and the crawling thing is because XP was slow at redrawing windows. It's fine on Vista and above. One moment, please :)
  • UNK
    UNK over 14 years
    Right, edited the script there, try that :)
  • Bless Yahu
    Bless Yahu almost 12 years
    THIS should have been picked as the answer. Glad I found this.
  • Tim Partridge
    Tim Partridge over 11 years
    This behaviour is only true for my right windows key and not my left windows key. The choice of my left or right shift key is irrelevant. Can anyone else confirm this behaviour? If I use my left windows key then the window resizes instead of moving to the other monitor.
  • Roland Pihlakas
    Roland Pihlakas almost 11 years
    Though under Windows7 You cannot move from the taskbar menu, You still can move the windows using shortcut keys: Ctrl+Space and then M, arrow keys, finally Enter. en.wikipedia.org/wiki/…
  • Amit Naidu
    Amit Naidu over 6 years
    Correction: In Windows 7, you can move from the taskbar - Use Shift + Right Click