31

Imagine you do this...

  1. Connect your external monitor.
  2. Start some apps, some on each monitor.
  3. Disconnect the external monitor.
    • All good because all the apps move the primary monitor.
  4. Re-connect the external monitor.
    • The apps stay on the primary monitor, but it'd be very nice if they moved back to the external monitor they were on before.

Using Windows 10. Are there any solutions or workarounds to this to moving the apps back to the external monitor automatically?

joelsand
  • 419

9 Answers9

8

Win Redock has worked best for me. Redock is automatic - saves and restores windows without any intervention. Magic! Its open source too!

B T
  • 801
1

I have, in the past, used an Autohotkey tool called Windowpad for this. Apparently this has now been replaced with a new, enhanced version called WindowPadX. Scroll down to see the readme. Full documentation is here.

This was crucial to me on multiple monitors. I loved to be able to easily switch a window between the two.

You can set hotkeys for the following (from the readme):

Possible actions to be configured on hotkeys

Window actions

Multi-Monitor

WPXA_MoveWindowToMonitor: Move window between screens, preserving relative position and size.

WPXA_MinimizeWindowsOnMonitor: Minimize all windows on the given Screen

WPXA_GatherWindowsOnMonitor: "Gather" windows on a specific screen.

WPXA_FillVirtualScreen: Expand the window to fill the virtual screen (all monitors).

General

WPXA_MaximizeToggle: Maximize or restore the window.

WPXA_TopToggle: Toogles "AlwaysOnTop" for given window

WPXA_RollToggle: Toggles "Roll/Unroll" for given window WPXA_Move: move and resize window based on a "pad" concept.

WPXA_TileLast2Windows: Tile active and last window

Multi-Monitor Mouse actions

WPXA_MoveMouseToMonitor: Moves mouse to center of given monitor

WPXA_ClipCursorToCurrentMonitorToggle: Toogles clipping mouse to current monitor

WPXA_ClipCursorToMonitor: Clips (Restricts) mouse to given monitor

General Mouse actions

WPXA_MouseLocator: Easy find the mouse

You can find it and other tools among a "A curated list of awesome AutoHotkey libraries, library distributions, scripts, tools and resources" here

ludinom
  • 25
1

What you can do is one of the following:

Scenario 1: When you disconnect the external monitor (as of Windows 11). Use ALT+TAB to select the visual Code Window and then press Windows button + Shift with either left or right arrow key which "moves" your active app between displays/desktops.

Scenario 2: When you disconnect the external monitor use ALT+TAB to select Visual Code App and then press ALT+SPACEBAR and then R to Restore app and then you can either use ALT+SPACEBAR again and choose X to maximise in current display or you can just use your mouse with the window that "popped up".

Scenario 3: (If Option is not disabled) When you disconnect the external monitor and use ALT+TAB to select Visual Code app and Press ALT+SPACEBAR and choose M to move the window with the arrow keys to your display.

I have experimented with all the options. The first scenario was especially useful to move the apps quickly between the displays especially if it is missing. The second one is the most common I use as the first one is new keys I have learned recently so I am not used to using the combination yet. The third option is rarely available so I only picked it up from researching the same problem I had with Visual Code.

Hope these options can assist with anyone that encounters the same issue. This should work with any app as I have experienced it a lot with the Visual Code app.

0

Some gpu's have support for this such as Nvidia control panel which allows you to apply settings for this and a lot of other features.

Or you could just set the multiple display settings to mirror the desktop (instead of extend) on all monitors if that works for you.

0

I use UltraMon (I believe it is Open Source) and in certain circumstances, it can do this, if configured correctly.

First get the program UltraMon installed. Then, when it is running, lets say right now you only have one monitor plugged in (doesn't matter the number), create a profile:

  • Right Click the icon in the systray
  • Left Click Display profiles
  • Left Click new Display Profile, Name it (for example, what I do is give it a number reflecting how many monitors you are using, like Profile 1).
  • Now you have one. Cool, you can create wallpaper for each monitor, screensavers, etc. Get all of your icons just the way you want.
  • Right Click the systray Icon.
  • Left Click Desktop Icons Left Save Positions

Now connect/disconnect other displays. Create a profile for this new setup. Maybe call it "Profile 7" for having 7 monitors plugged in. Now save the icon positions when they are the way you want them.

You can easily use this tool to switch back and forth between profiles. You can easily place desktop shortcuts to quick-switch between profiles.

Lastly, in the advanced options, you can tell UltraMon to do this all the time, automatically for you, but that may require a paid version (one time lifetime fee).

I bought UltraMon back in 2009 for $19.99 and it was totally worth it.

fixer1234
  • 28,064
PyTis
  • 109
0

Windows programs - called app(lication) nowadays - can save the position of their window in a file or the registry. If one knows where this data is, it can be edited manually in the notepad or registry editor. (incorrect registry entries may cause Windows instability or errors)

The creation of an automated way should be easy for someone with a bit of coding skills and it can be started as needed (i.e. after the monitor is re-attached). This could be done by an action script, .bat file or a native app.

The applications in question will need to be closed previous to this though in order for the desired positions to become implemented.

Another possibility with "online" capability (no app restart needed) would be if Windows allows accessing a window of one process by another. An approach could be the SendMessage and WindowProc functions.

(I'm unsure at this point if this only applies to threads of the parent application or can be done by threads of other applications as well...and of course requires good knowledge in programming for Windows)

https://msdn.microsoft.com/en-us/library/windows/desktop/ms644950%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

Sends the specified message to a window or windows. [...] If the specified window was created by the calling thread, the window procedure is called immediately as a subroutine. If the specified window was created by a different thread, the system switches to that thread and calls the appropriate window procedure.

WM_Move message https://docs.microsoft.com/en-us/windows/desktop/winmsg/wm-move

Sent after a window has been moved.

A window receives this message through its WindowProc function.

https://msdn.microsoft.com/en-us/library/ms633573%28v=VS.85%29.aspx?f=255&MSPPError=-2147217396

An application-defined function that processes messages sent to a window. [...]

-1

If you shift+right click the icon on the taskbar, then press move, you can use the arrow keys to move the window and the enter key to set the position. I had the same issue a few years ago.

Another solution is to use DisplayFusion to snap the window to the closest monitor (the only one connected) with the "Move all windows to current monitor" hotkey.

-1

There aren't any solutions to do this, you must use the windows key on the keyboard with the left right arrows, to move in between screens, or windows key+shift+left/right in order to move to portions of the screen.

Windows key + P also helps in multi monitor situations to aid with mirroring/extending etc.

But again, once you disconnect your screen, if those windows had any metadata on them, they are gone afterwards

Pixel
  • 109
-1

You can do this, if you're an old "keyboard guy" like me ;-] I figured this out ages ago, being that I've been multi-mon since the early 90's, it's been a very longtime issue, amongst slightly differing UIs.

The easiest way I've found for offscreen/border apps, is:

  • Simply select the app, via the taskbar or Alt-Tab
  • Hold the Alt key down, and press the spacebar (Alt-Spacebar)
  • You'll see a menu, on your main screen(s), one option of which will be "Move", with the M underlined.
  • As such, press the "M" key, while the menu is still on-sceen
  • At this point, don't point/click/etc, as you're now "re-positioning" the active window (the offscreen one).
  • You can drag the mouse around (NO BUTTON PUSHES FOR NOW), and you should see the app sort of come in/out of the main screens, enough for you to place it somewhere more convenient for use.
  • Alternatively, you can use the arrow-keys to move the app around, works just as well, but a bit slower, to figure out where the windows is and which way it's heading.
  • Once you have the Window in a "good place", where can actively size/move it, either click the main-mouse-button, or if using the keyboard method, hit the "enter" key.
  • The window/app should now be easy to move/adjust.
  • Repeat for all windows/apps that are off-screen.
phuclv
  • 30,396
  • 15
  • 136
  • 260
PeteG
  • 582