I never had this issue before but then I got a new video card and two new monitors. The monitors are identical but one is connected via hdmi and the other via display port. The hdmi monitor goes to sleep and the display port one doesn't, it just keeps displaying the Ubuntu screen for logging in. This causes windows from one monitor to move to the other if I log in before turning the other one back on.
How can I prevent this from happening?
Aside from this, even when neither monitor goes to sleep, sometimes the login prompt would be on the other monitor and that once again leads to them getting swapped in order.
Edit: requested info:
lspci| grep -i "video \| display \| vga" 01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Polaris12 (rev c7)
lshw -class video WARNING: you should run this program as super-user. *-display description: VGA compatible controller product: Polaris12 vendor: Advanced Micro Devices, Inc. [AMD/ATI] physical id: 0 bus info: pci@0000:01:00.0 version: c7 width: 64 bits clock: 33MHz capabilities: vga_controller bus_master cap_list rom configuration: driver=amdgpu latency=0 resources: irq:48 memory:c0000000-cfffffff memory:d0000000-d01fffff ioport:e000(size=256) memory:fea00000-fea3ffff memory:c0000-dffff
The video card model is
Gigabyte Radeon RX 550 D5 2GB Graphic Cards GV-RX550D5-2GD
Edit: I think the issue was a bad video card. Issue went away with a different radeon card.