I’m using OpenSuse Tumbleweed, KDE Plasma with Wayland.
I am using Window rules to set the position of windows. I have two monitors, one connected via DVI, the other HDMI. When I boot the computer, the HDMI is 0 and the DVI is 1. I have set a window to always open on 0. However if the computer goes to standby, when it resumes the DVI connected monitor is now 0 and the window opens on that instead.
Ok, and also check ‘Background Services’…is KScreen 2 running? You could try stopping it to see if that makes a difference. (This is all handled as part of KWin these days.)
And how KDE is supposed to know that it will have the second monitor when it enumerates them? It is the same as opening bug report about /dev/sda becoming /dev/sdb after reboot. The order in which screens are enumerated could be different on resume. The relative position of both screens does not change though so KDE maintains the correct configuration.
I guess the real question is - how to reference a screen using some unique persistent information. E.g. I had similar issue using mpv and external TV over HDMI after I switched to Wayland. I referenced TV using the screen number 1 which could change. At that point mpv had only very basic Wayland support. Later mpv was extended to support the screen name and I stopped caring which number TV got.
That sounds like something for KDE forums rather than bugzilla.
I understood that the OP says it DOES get swapped. No matter which monitor comes up first, the desktop environment should to be able revert to the preferred screen arrangement when both monitors are active, (as it does with Windows actually).
In any case i don’t see how a KDE discussion will be any more effective that KDE bug report.
I did a further test. I noticed it was also getting a “display unplugged” “display plugged in” notifications when I resumed from suspend/sleep. So, I started from a fresh boot and just unplugged and plugged in the HDMI monitor, that swaps the screen numbers. Furthermore, turning the screen off and on does it as well.
I read elsewhere that the screen numbers are numerated in order of when they are plugged in. So the problem is, at a guess, the HDMI and DVI behave differently on suspend/resume. I do not have the hardware to check whether this is a problem for multiple identical connections. Maybe window rules should be using some different screen identifier.
The solution I’ve found is to not turn the HDMI connected monitor on till after boot (can turn off and on if I forget). Then the suspend/resume doesn’t swap them because HDMI is already the second output.
You can find out the screen name with the kscreen-doctor -o command as used before. Mine is “HDMI-A-1” . I then used these commands to make a logout script
The sleep command is needed because otherwise it doesn’t seem to have a chance to re-register. Can put the logout command at the beginning of the login script instead but it works better doing it with two scripts. I don’t know how it would work with any further monitors, may need to put a sleep in between each monitor or the first sleep would be fine.