Saving windows position with Windows rules with two monitors?

Hello,

On KDE plasma 6.6.

At work, with two 1920x1080 monitors, when I use windows rules to make my Thunderbird main window to be, for example, in the monitor to the right on the second virtual desktop, it works perfectly.
But it works flawlessly because I always use the two monitors !

At home, some time I use two 2560x1440 monitors, sometimes I use only one.

The problem, I think, is that on the window rules, the position is in pixels with the total screen width space in mind (here it’s 5120x1440).
So, for example, my Thunderbird rule is now :
Position : Initially 2630 x 34
Monitor (Or Screen, I don’t know the English word used) : Initially 0
Virtual Desktop : E-Mails

You see what is the problem there !?

For the virtual desktop, the Y position is relative (If it wasn’t It would be 1440+34, not 34).
But to follow the same logic, it should be 70x34, relative to the virtual screen AND the Monitor !

In fact, if I deactivate the monitor 1, I want the position to be 70 x 34 on the monitor 0. BUT how would KDE know that the monitor 1 was 2560 width ?
At the moment, there is a good safegard so Thunderbird is only in the right (or in the left, depends what monitor I deactivate) of the monitor. I recall some years ago, on MS Windows, when I had program windows hidden in invisible areas of the screen. That’s not happening here.
But It certainly could be better.

I think the most logical would be that the position would be relative with the virtual screen and the monitor.
If my Windows rule stated that the window should be in screen 1 at 70 x 34, then it would fall back to the same position on the only available screen if the screen 1 is not available.

I’m aware this needs much more thinking in case of more than two monitors : on what monitor fall back ?
Could this be a rule that the user can choose ? Example in lieu of Monitor: 1, the rule could be Monitor: 1,0,2 => if 1 is here, the windows is here, if not, the rule falls back to monitor 0, and if it’s not here, it falls back to 2… and if not here, it falls back to the available one).
But I strongly believe the relative position should always be the same.

What do you think, and are you planning on working in those aspects in the future ?

Thank you.

I just saw that for a next KDE, you’re planning on making virtual desktop relatives to screens.

If I’m not mistaken, that makes the window rules more complex : now we have to state a pair [virtual desktop, screen], or am I mistaken ?

I like the idea and would like to add something:

Screens can have different sizes, so it might be good to have the option to set the size relative to the resolution. Either by percentage (could be used for position, too) or by specifying the distance of the right lower corner of the window to that of the screen (e.g. for width of 1920, and pos of 200, -800 would stretch the window to a size of 920 (1920 - 200 - 800).

You want the Window’s position AND size to adapt if the resolution change ?
That’s somewhat greedy but I suppose it could be interesting for someone who often change screen size.

The problem is that if the Window Rules panel is too difficult to use, very few will use this fantastic feature of KDE, and it could be difficult to solve a problem, when things don’t work like we want (it is already sometimes a challenge).

The HMI for what we are discussing in this thread would be a challenge, I think.