Krohnkite implements a policy that automatically floats all
non-resizable windows to prevent breaking layouts. However, when a
window is started directly in fullscreen, KWin naturally reports that
the window is not resizable, even when it' resizable in non-fullscreen.
This causes confusion in Krohnkite, and the script wrongfully floats
such windows.
This commit fixes this by delaying the application of the policy as much
as possible. New windows are initially marked "undecided", and the test
will be performed only when it's required.
The previous default behavior was derived from dwm. It totally make
sense for dwm, because it has "tag" system instead of virtual desktop.
However, most people are more used to virtual desktop system and
consider each desktp as physically independent entity. Thus, it makes
more sense to turn this on by default.
This allows backends to decide what "maximization" actually is. This is
better than directly controlling maximized windows in Engine, because:
1. This works well with the KWin maximization animation effect.
2. The logic is simpler and more adaptable.
This feature is implemented by adding a new window state: Maximized.
It's almost like FullScreen, but window geometry should be manually set
by Engine.
The previous method relied on `any` type and `instanceof`, but the new
method relies on string-based mappings, providing better safety and
clearness.
Also, `CONFIG` now maintains a list of layouts, instead of boolean
values (`enable*Layout`). This will allow implementing extra features
like configurable default layout, configurable layout initial states,
etc.
The previous implementation simply took the initial noBorder value, and
enforce it throughout the lifetime of a window. The new implementation,
instead, respects changes made to noBorder.
This is achieved by introducing "noBorder managed mode" to distinguish
user- or app-induced changes from changes made by Krohnkite itself.
Older `tsc` complains about variable initialization inside *exhaustive*
switch statement.
This is worked around by making one `case` passthru to `default`.
Given the master ratio, `r`, stack ratio, `q`, used to be:
q = (1 - r) / 2
This caused squeezed windows when the layout mode changed from single
stack to double stack.
To make the transition more smooth, q is now:
q = 1 - r
... and, since `p + 2*q > 1`, weights are normalized during computation.
The algorithm becomes opaque, but it works anyway.
This is a generalized version of focus-caching for each column/row.
If there are multiple candidates w/ the same verticla/horizontal
distance from the current window, choose the most recently focused
window.
This eases, for example, switching b/w two or three columns repeatedly
to access certain windows.