I'm on a Nvidia GTX 950 GPU desktop system with three monitors attached. One monitor on HDMI out port, other two on DisplayPort ports.
The default behavior is that turning off one of the 'secondary' monitors causes xrandr to resize the virtual desktop and rearrange all the windows to fit the surviving displays.
Is there a way to have xrandr ignore the removal of a HDMI cable and/or associated monitor so that it keeps the 'virtual desktop' the same (even if the windows are off-screen and difficult to access) and not do the re-arrangement it does to consolidate all the active windows into the surviving displays? Further, to re-insert the cable and same monitor and light it back up?
Both Ubuntu 16.04 and 16.10 seem to have the same basic behavior. I have both as boot options. Thank you.
EDIT 2017: I have found some bash and python scripts to try and automate rearrangement of off-screen windows. These can be of some use to cope with the situation. Even with Ubuntu 17.04 (format fresh install) this general problem is still ongoing for me. Script discussions: How to recover offscreen window after disconnecting second monitor? and Move windows to specific screens using the command line
Best Answer
This may work HDMI/VGA ports but not DP due to some standards for DP that should always pass detection events.
I could test this on Dell E6410 with VGA/DP. Removing cable from VGA now does not trigger xrandr resettings and move windows.
gksu nvidia-settings
sudo mkdir /etc/X11/xorg.conf.d/
sudo nano /etc/X11/xorg.conf.d/90_my_nvidia_hacks.conf
Paste the device section
Add to it this line
Option "UseHotplugEvents" "false"
Reboot or restart lightdm
You may find this useful too
Option "AllowEmptyInitialConfiguration" "true"
which create empty monitor section even no screen is connected on X start.Reference: