Bug 499732 - Inconsistent Monitor / Screen Indexes for Window Rules
Summary: Inconsistent Monitor / Screen Indexes for Window Rules
Status: REPORTED
Alias: None
Product: kwin
Classification: Plasma
Component: rules (other bugs)
Version First Reported In: 6.2.5
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 491230 (view as bug list)
Depends on:
Blocks:
 
Reported: 2025-02-09 22:23 UTC by Aeryn
Modified: 2025-03-23 16:30 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aeryn 2025-02-09 22:23:20 UTC
SUMMARY
Whenever my monitors go into power save / sleep mode, or when I reboot, the order of my screens for the purposes of Window Rules is reshuffled. This does not involve adding or removing monitors from the system, though it is possible that some of the monitors stop being detected by the system while in power save mode.

This makes using an app that *must* be on the primary screen to work properly a pain in the butt, as I have to change my window rules every time. Further, as display numbers don't seem to be shown in Display and Monitor Settings, determining which screen is which is a matter of trial and error.

STEPS TO REPRODUCE
1. Have three monitors connected (In my case, 1x MSI MPG 341CX QD-OLED, and 2x Dell G2724D)
2. Either put the screens to sleep *or* reboot the computer.
3. Screen Numbers are now randomized.

OBSERVED RESULT
Screen Index for window rules has been randomized, and windows rules need changed to assign windows to the correct screens.

EXPECTED RESULT
Screen Indexes remain consistent so long as the same display setup remains in use. *Ideally*, this would follow the Screen Priorities setting, to allow users control over these indexes, and allow them to remain somewhat consistent between types of setups even as screen are connected and disconnected.

Alternatively, a window rule option that allows setting screen by some sort of monitor ID / serial number specific to the monitor hardware (and doing nothing if said monitor is not connected) would be extremely useful, allowing very fine control over the windows in specific setups.

SOFTWARE/OS VERSIONS
Operating System: Ultramarine Linux 41
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.10.0
Qt Version: 6.8.2
Kernel Version: 6.13.2-cachyos1.fc41.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 24 × AMD Ryzen 9 3900X 12-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: AMD Radeon RX 6800

ADDITIONAL INFORMATION
Comment 1 Ismael Asensio 2025-02-22 21:40:54 UTC
*** Bug 491230 has been marked as a duplicate of this bug. ***
Comment 2 Bings 2025-03-23 14:39:37 UTC
I also have this issue. The rules when choosing a screen, you pick a screen number. This aligns with the output numbers that you can see with the command: kscreen-doctor -o

The problem is that output numbers are assigned to each monitor in the order they are seen as connected. This is not a constant and can result in monitors not having the same output number between standby/resume and as the OP reported boot and screen standby.

The only way I've found to manipulate this is to only have the primary monitor on for boot and turn my second monitor on after. Presumably for more, you turn them on in the order you want. 

Rules needs a better way to identify screens.
Comment 3 Felix Miata 2025-03-23 16:30:19 UTC
Basically what this means is session restore with multiple displays is an abomination. When I reboot, all windows open on primary display, and those that should have opened on other displays open in duplicate. If session is exited without closing the duplicate(s), then on next open they are opened in triplicate, and if repeated, in quad, etc. I always keep app fcl (File Commander http://silk.apana.org.au/fc2development.php) open (virtually) filling virtual desktop 4 on the (upper) right display, with primary being either left or lower left, depending whether I'm using 2 or 3 displays. It religiously gets reopened on the primary in at least 2 copies.