Bug 427677 - Feature Req: allow setting window position relative to specific screen
Summary: Feature Req: allow setting window position relative to specific screen
Status: REPORTED
Alias: None
Product: kwin
Classification: Plasma
Component: rules (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR minor
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-14 08:19 UTC by Nowa Ammerlaan
Modified: 2022-04-01 03:31 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nowa Ammerlaan 2020-10-14 08:19:48 UTC
SUMMARY

We can already set window rules for the (absolute) position of a window in the whole X screen, we can also set a specific screen a window should be on. What we cannot (yet) do is set a specific position on a specific screen for a window. This is useful on setups with a varying monitor configuration, e.g. laptops that sometimes have a external monitor plugged in. If this external monitor is set to be left of or above the internal monitor, the physical position of the upper left corner (0,0) of the X screen will be changed, and therefore the windows with position rules will be put into a different position than if the external monitor were not connected.

What I suggest is adding e.g. a drop down menu to the 'Position' rule, where the  user can select e.g, the following options:
- Absolute (which is the current behaviour)
- Monitor/Screen 0 (e.g. if the position is set to 960,0 the window will be halfway the first monitor if it is Full HD)
- Monitor/Screen 1
- etc ...

I imagine that in the background this would work by determining first the position of the monitor the window should be on, and then adding on top of this the user specified (relative) position which would give the (absolute) position the window should be at.

E.g. I want window foo to be on screen 2 (the third monitor) which is at position 3520x0, I want the window to be 200 pixels from the left side of the monitor. Now I would have to set the position of the window to 3720x0, and it will only work in this specific monitor configuration. What I suggest is allowing the user to set the position to '200x0 on screen 2' instead. In the background the absolute position would be calculated by getting the position of screen 2 (3520x0) and adding the user specified position (200x0) to get (3720x0) which would then be where the window will be positioned. The advantage of this is that this will still work as intended if the position of screen 2 is changed.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.8.14-gentoo
KDE Plasma Version: 5.19.5
KDE Frameworks Version: 5.74.0
Qt Version: 5.15.1