I think I found a reason why this happens. I left xrandr running in a loop, logging everything and then I forced both displays into standby with xset.
After checking the logs this is what I noticed: DP-0 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 597mm x 336mm DVI-D-0 connected 1920x1080+3840+0 (normal left inverted right x axis y axis) 510mm x 290mm DP-0 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 597mm x 336mm DVI-D-0 connected 1920x1080+3840+0 (normal left inverted right x axis y axis) 510mm x 290mm DP-0 disconnected (normal left inverted right x axis y axis) DVI-D-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 510mm x 290mm DP-0 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 597mm x 336mm DVI-D-0 connected 1920x1080+3840+0 (normal left inverted right x axis y axis) 510mm x 290mm DP-0 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 597mm x 336mm DVI-D-0 connected 1920x1080+3840+0 (normal left inverted right x axis y axis) 510mm x 290mm When displays go to low power mode my 4K screen is briefly turned off and then back on. When 4K screen is turned off, the 1080p becomes primary and and all the windows are moved to it, when screen is connected back and windows are restored everything is put in the wrong place. This seems like a wrong implementation of DPMS with the screen manufacturer, not much can be done about this, but WM could go around this. (strangely enough, same thing happens if I just turn off my HiDPI screen, I don't know how I didn't remember this before) Which brings up a separate problem - handling of windows when one screen is turned off. WM should remember position of windows when one screen is disconnected. Windows should be then placed on the _visible_ area on the remaining screen. When previous screen is connected again if windows were not moved, they should go back to their original positions. -- You received this bug notification because you are a member of DX Packages, which is subscribed to compiz-plugins-main in Ubuntu. Matching subscriptions: dx-packages https://bugs.launchpad.net/bugs/1295267 Title: Windows change Monitor/Desktop after screen lock Status in Unity: Fix Released Status in Unity 7.1 series: Fix Released Status in compiz-plugins-main package in Ubuntu: Fix Released Status in unity package in Ubuntu: Triaged Bug description: I run a dual monitor configuration, with one portrait and one landscape. I nearly always have multiple applications open in multiple windows across both monitors and all virtual desktops. When I lock the screen and then unlock, my application windows will move from their original position. Sometimes they are in completely random positions; Other times they seem to get the monitors confused, and rather than being in the top half of the portrait monitor they are on the top half of the landscape monitor; Sometimes it is only a new desktop, but the monitor position is the same; Sometimes it is the same desktop, but on the other monitor. Description: Ubuntu 13.10 Release: 13.10 What I expect to happen: When I unlock my computer, all the windows are in the same position on the same monitor and desktop as I left them. What actually happens: When I unlock my computer, some or all of the windows have been changed to a random position on a random monitor and/or desktop. To manage notifications about this bug go to: https://bugs.launchpad.net/unity/+bug/1295267/+subscriptions -- Mailing list: https://launchpad.net/~dx-packages Post to : dx-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~dx-packages More help : https://help.launchpad.net/ListHelp