A little background: My home setup consists of 2 4k monitors, one on top of each other. Bottom one is primary and top is secondary. Primary is on a KVM so I can switch between main machine, gaming machine, and work machine. The top monitor I just switch the inputs between HDMI and DP for the work machine as the work machine is DP so I just have a DP cable going straight to it. For primary I use a DP to HDMI adapter that goes to KVM from the other machine DP port. Basically the work machine has 2 DP, VGA and DVI. No HDMI. I also have 2 extra side HD monitors for work using DVI and VGA as one of those is actually the primary for the work one while the two 4ks are secondaries along with another HD.
It's always super annoying when I turn off my top monitor as it makes all the windows on my work machine shuffle all over the place. The bottom one is ok because of the KVM. We have the same issue at work, so we just keep our monitors on, but this is my personal monitors so I don't really want to do that. Also I need to be able to switch input to HDMI for my personal machine, that too, causes the window shuffle thing to happen. It's a windows bug with DP that has been around since like 2010 and Microsoft refuses to fix it. To make matters worse for whatever reason, Linux Mint does the same thing but with HDMI! So any time I was switching between work/personal it was always a battle dealing with that. I fixed the Linux issue by getting a HDMI dongle that basically emulates that a monitor is always there so I plugged that in at my personal machine then put the HDMI cable in going to the monitor. The work PC is DP and I could not find an adapter like that which had DP so I just put up with the annoyance with the work PC. I was just happy my personal one was ok.
Fast forward to today. I should have did this like a year ago, but I bought another KVM switch to use for the top monitor, using it for HDMI only. No keyboard or mouse attached to it. I just finished setting it up so I can switch between the work PC and home PC on that monitor too and it works flawlessly, and best of all, the PCs do not shuffle all the windows around when I turn off or switch the monitor!
To make things EVEN BETTER, I can now run BOTH monitors at 60hz now. Before I had to do one at 50 and one at 30, or 40 and 40 etc. I could not do both at 60 or even one at 60 and other at 30. It was a battle trying to figure out the right combo as while I'm trying to set that up everything would flicker and do weird crap. But now that I'm running both the same brand/model KVM for both monitors it seems Linux is happier now and lets me run both at 60. No more weird lag when dragging windows from one to the other. Youtube videos also feel a bit more smooth.
For about $200 this extra KVM was worth every penny for my sanity and I wish I had bought it a year ago. I had thought of it but at the time I did not realize I'd be working from home semi permanently.
BTW this is it. I highly recommend it:
https://www.amazon.ca/gp/product/B07G883R35
I own 3 of these now. Two here at home and one at work as I have a laptop I use for web surfing that I switch back and forth to.
Of course for at home, I could have got one that does dual display, but I kind of like the granularity of being able to switch only one monitor. I set all my important stuff on the top monitor so I can still watch my alarms while neffing. when working from home we don't open everything we just divide up the tasks. Since I knew this model worked well I wanted to stick with it. 90% of KVMs out there are pure garbage. They lock up, or lose mouse/keyboard, or are slow to switch etc. This one is fairly quick. The monitor takes a few seconds to switch but mouse/keyboard is instant.
But yeah, this is a big win today. Now I just hope this continues to work. The last time I had a semi working solution involving a DP to HDMI converter and the same style of dongle I was using for my personal machine, it would randomly die on me. There is still a DP to HDMI converter involved in this setup so hopefully i won't face the same issue... I'll know tomorrow when I'm actually using my work machine.