When I plug a second screen, all windows move to the left screen, instead of staying on the current or moving to the primary screen. Please tell me what info you would need to debug this in more details. Reproducible: Always
The windows are not moved at all. Windows have a position in their X virtual space. E.g. 0/0 when plugging in a screen left of the current screen the windows keep their position in the X virtual space. So they are still on 0/0, but that's now mapped to a different output. There is nothing one can do about it. Windows are positioned on the virtual space not on an output. We cannot know what the user expects and what the applications expect.
Then you can close it. Now it makes sense, but it wasn't before :)