Windows on second monitor moves to primary monitor after sleep/lock

257,765

Solution 1

A similar case on Microsoft Community mentioned a workaround, have a try.

  1. Start Control Panel --> Device Manager
  2. Select View --> Show hidden devices
  3. Expand Computer --> Monitors*

When you expand the Monitors you will see your current monitor (highlighted) and all the disconnected monitors (greyed out). You may see monitors with "non-PNP" and "PNP" listed as well. I believe these are aliases to your current monitor (at a lower resolution) before Windows installed drivers for it.

I uninstalled ALL the greyed out monitors. Right-click on these monitors and select uninstall. Keep only the highlighted monitor you are currently using.

  1. Uninstall all greyed out monitors (even non-PNP and PNP monitors)
  2. Reboot your system.

After doing this my windows don't resize after my monitor goes to sleep. You can quickly test this by temporarily setting your monitor sleep time to 1 minute.
Settings --> System --> Power & Sleep --> Screen [1 minute]

Source: https://answers.microsoft.com/en-us/windows/forum/windows_10-hardware-winpc/windows-10-multiple-display-windows-are-moved-and/2b9d5a18-45cc-4c50-b16e-fd95dbf27ff3

Solution 2

It was stated that:

"The technical term for the problem is "Rapid Hot Plug Detect," but with the latest Windows Insider build 21287 or above, Microsoft has worked to mitigate the issue. With this release, when you wake up from a sleep, all your windows should appear where you previously left them.

You'll need to join Microsoft's Insider program to get the new feature, which will work by default if you're connected to at least one external monitor with a laptop, or two monitors on a desktop setup. It should also work across brands, hardware specs and connector types. If you're not willing to join the beta program to test it right now, Microsoft is expected to ship the final version by October, 2021."

(reference to original article)

It works for me after waking up from sleep! However, it does not work after waking up from hibernate. Hopefully, Microsoft is planning fixing this as well for the upcoming update.

Solution 3

The currently accepted answer by Origami does not work for me.

But this workaround helps, although far from a complete solution.

Prerequisites:

  • system must be locked before going to sleep (lock it by the key combination WINDOWS-L and let it then go to sleep or make sure it locks by itself before sleeping - maybe with screensaver settings, I always lock manually, so did not test this; just letting the PC go to sleep (unlocked) will not work, even if it asks for the password when waking up)

Workaround:

  • when the monitors are sleeping, move the mouse
  • wait until the monitors turn on
  • the monitors might blink once or twice, just give them good 5 or 10 seconds, so they are 100% on and detected by Windows
  • press a key, mouse button or ctrl-alt-delete, depending on Windows configuration, so that the login screen appears, asking for password
  • enter password and unlock the PC

Result:

  • windows are where they were left

Sometimes only some windows stay at their position and some get moved to the main display even if you do the described workaround. I guess there is nothing more to do than wait for Microsoft to fix this.

Solution 4

TL;DR - if the windows are moving to a VGA connected monitor, it looks like there are three options, in order of "fixed" to "workaround":

  • Change the connection to that monitor to something other that VGA (changing to DisplayPort connection fixed it for me)
  • Make the VGA monitor the Primary Monitor.
  • Unplug the VGA monitor, then plug it back on each resume.

I had this problem - all the windows shifted to one monitor on resume from sleep / hibernate. The LCD monitor the windows shifted to was connected by VGA cable - my primary monitor is connected by DisplayPort, plus the laptop display.

Turning off the VGA monitor didn't force the windows to shift back to the primary monitor, but unplugging the VGA monitor did force the windows back.

I guess that the VGA connection does not report that the monitor is actually off, just that there is a monitor present, and Windows detects it before the DisplayPort connected monitor or even the internal laptop display, so moves the Windows to the VGA monitor.

Fortunately, the VGA connected monitor also has DisplayPort connection, so I changed the monitor to DisplayPort, and the problem was resolved.

Solution 5

I ran into a similar issue and the answers that were provided here did not resolve the issue. After a few searches, I found a GitHub app that did resolve it. Take a look at PersistentWindows. So far it has worked well for me.

(Note: I have no affiliation to PersistentWindows.)

Share:
257,765

Related videos on Youtube

Can
Author by

Can

Updated on September 18, 2022

Comments

  • Can
    Can over 1 year

    I'm using latest Windows 10. I have dual monitors and am working on software development. I move Visual Studio to second monitor to work on it.

    When I lock wndows and leave computer and go somewhere and come back after 20-30 min both laptop and second external monitor is black and I need to enter my password. When I unlock the computer Visual Studio 2017 moves to the primary (laptop) diplay.

    Everytime I have to move Visual Studio again to second monitor. Is there a way to solve this problem?

    • Jari Turkia
      Jari Turkia over 3 years
      My new monitor is bit slow to wake up from sleep and does exactly what you describe. Previous monitor was DVI-D -connected, new one is DisplayPort. If only I could instruct Windows to wait a bit longer.
    • Dan
      Dan almost 3 years
      Since I can't add an answer, I will write this comment. Make sure to have the same Response Time set to Normal on both monitors, change the Display Port version to 1.2 (if you have one and if possible) and go to Device Manager and click Update Driver on both monitors and let Windows find the driver for you on the internet. Also disconnect any other cables and let only the 2 cables you use. This solved my issue. Might help others, since it was so annoying.
  • Mudo
    Mudo over 5 years
    I can´t believe it was so simple to solve this. Had an HDMI cable forgotten into a drawer for almost 1 year of dragging 3+ screens back to the second monitor after unlocking the screen. Thnak you very much, sir.
  • queezz
    queezz about 5 years
    This workaround has no effect whatsoever on my system.
  • queezz
    queezz about 5 years
    Now having this problem with to identical monitors connected to two DisplayPorts.
  • John Gardner
    John Gardner about 5 years
    I too am now suddenly having this issue after switching from 2 old hdmi to new 2 displayport monitors!
  • KYL3R
    KYL3R almost 5 years
    This worked perfectly for me. After upgrading graphics card the chrome window was on the main monitor after each wake-up from sleep. Now after uninstalling all grayed-out monitors its fine like it was before. Thanks
  • Tigerware
    Tigerware almost 5 years
    The flickering of the screens went away completly, so definitely a big improvement! The windows still move all to the same monitor though.
  • Tigerware
    Tigerware almost 5 years
    For me the monitor that is connected through DVI is the dominant one, compared to two others, which use DisplayPort.
  • HelloWindowsPhone
    HelloWindowsPhone over 4 years
    not working for me
  • user19496
    user19496 over 4 years
    Confirmed as working 2020-01-02. I did "Uninstall device" to all grey icons except "Location: on Microsoft Basic Display Driver".
  • user19496
    user19496 over 4 years
    In the end: I also had to do this superuser.com/a/1187076/19496 i.e. never turn off monitors.
  • wiktor.wandachowicz
    wiktor.wandachowicz over 4 years
    Interesting thing to note here is that some time after I posted my workaround above in aforementioned thread on Microsoft Community, some update to Windows 10 fixed my issue completely. Hooray! :) I mean, the dwm.exe process is sometimes restarted automatically after connecting back the monitor, and I didn't need my own "solution" for a long time.
  • Delphi.Boy
    Delphi.Boy about 4 years
    Worked for me. And by the way, for testing you don't have to wait for a sleep to trigger. Just lock your machine using Windows + L and log in again.
  • zumek
    zumek about 4 years
    I have on each on VGA and HDMI. Making VGA primary did work initially for me but, the issue suddenly came back for no apparent reason after about 2 weeks - doomed! Going back to Win7 :D
  • Bob Phrapples
    Bob Phrapples about 4 years
    Windows 10 GeForce RTX 2080 I don't have View System Topology, I think this is only on older cards. I found this nvidia.com/en-us/geforce/forums/discover/239683/…
  • OXiGEN
    OXiGEN over 3 years
    Problems with 2 identical monitors with VESA certified DP1.4 cables. 1m for primary. 2m for secondary. No problems with old HDMI cables.
  • OXiGEN
    OXiGEN over 3 years
    GTX 960 running nVidia CP 8.1.959.0. There is no Workstation option in the tree. I checked all available options. Nothing for EDID Source.
  • anders-hou
    anders-hou over 3 years
    This only applies to Nvidia professional workstation graphics cards. The Workstation section is not available when using consumer gaming cards.
  • Murray Furtado
    Murray Furtado over 3 years
    Yes, solved! one of my screens was on VGA, I replaced the cable with HDMI (the other is DVI) and that solved it.
  • Cooper
    Cooper almost 3 years
    This worked beautifully for me.
  • Nick
    Nick almost 3 years
    This works fine for me on my laptop w/ external displays. The only clarification to make is to hit "Export EDID" for each file then go to the middle tab (Load) and load the file and check the box for the monitor it applies to. I named my exports "monitor1.txt" and "monitor2.txt" for easier tracking. Thanks for the solution!
  • Leo
    Leo over 2 years
    Also for me none of the in-windows solutions worked. Only third party apps have worked: "MonitorDetectKiller" community.amd.com/thread/191221 , "Custom Resolution Utility" monitortests.com/forum/Thread-Custom-Resolution-Utility-CRU , "persistent windows" github.com/kangyu-california/PersistentWindows , "dualmonitortool" dualmonitortool.sourceforge.net
  • Joshua Boyd
    Joshua Boyd over 2 years
    The 1 minute screen off timeout and Win + L do not reproduce the bug for me. Removing monitors in Device Manager didn't fix it either. I hope Windows 11 fixes this. Used to work fine on another laptop with the same screen. So it's not the screen.
  • Joshua Boyd
    Joshua Boyd over 2 years
    So this is the fix that they talked about in the Windows 11 presentation, that is supposed to keep windows on the same display. I hope this will work.
  • Vortex
    Vortex over 2 years
    thank you, PersistentWindows worked for me. nice utility. i see a tiny blip as it's restoring the windows but that's fine