https://bugs.kde.org/show_bug.cgi?id=448688

Michael <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #3 from Michael <[email protected]> ---
Created attachment 196640
  --> https://bugs.kde.org/attachment.cgi?id=196640&action=edit
Proof of concept

Reopening as it’s still valid on Plasma 6.7.5 / Frameworks 6.30.0 / Qt 6.11.2,
Wayland (Fedora 44).

Placement::placeSmart() still weights all overlapped windows equally (overlap
+= area, except the 16x for keep-above). So when there is no free spot, a new
window often lands on top of the window I was just working in, because covering
it costs the same as covering one buried deep in the stack.

PROPOSED BEHAVIOR

Make Minimal Overlapping stacking-aware:

1. Walk the windows from the top of the stack down, subtracting each from the
free area.
2. Stop just before the free area would become too small for the new window.
3. Place the new window in the remaining free area.

Recently used windows stay uncovered; only windows deep in the stack get
covered. If even the topmost window leaves no room, fall back to the current
behavior.

A cheaper variant closer to the current code would weight each overlap by
stacking rank, for example making the cost grow with how high the overlapped
window sits. That keeps the existing search and only changes the cost function.

PROOF OF CONCEPT

The attached KWin script implements this (top-down subtraction of maximal free
rectangles, centered in the smallest fitting gap, transients skipped). I've
used it daily and it behaves noticeably better than the current Minimal
Overlapping.

As a script it has to rely on a windowAdded hack: it runs after KWin's
placement and guesses app-requested positions from whether the window ended up
centered or cascaded. MR !8079 (placement callback) would make it a proper
script: https://invent.kde.org/plasma/kwin/-/merge_requests/8079
Doing it natively in placeSmart() would benefit everyone.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to