Commit Graph
2689 Commits
Author SHA1 Message Date
LGUG2Z cd1c9ce9ce perf(animation): do not build a picture to make a window paint itself
Making a window paint itself (a render of it is synchronous) went through
Snapshot::capture, which also allocated and filled a second picture of the
visible frame, copied it out of the first and cut its corners, to throw it all
away: about a quarter of what taking a picture costs, on the thread that
gates showing the window again.

Split rendering a window out of taking a picture of it and make paint_now only
render. And when taking a picture, do not run over millions of pixels to make
them opaque when a window has rendered them that way, as it does: look at a
grid of them across the picture, and only fall back to making every pixel
opaque if one of those is not.
2026-10-30 15:45:37 -07:00
LGUG2Z 126acaa074 chore(animation): trace what ghosts and animation frames cost
Time the picture a ghost takes of its window (allocating, PrintWindow and
turning it into a picture), the render a window is asked for to lay itself
out (paint_now), how long a ghost takes to make, and what the frames of a
group of animations cost: how long drawing them takes, how far apart they
come and how many are late. All at trace level, the frame statistics at
debug.
2026-10-30 15:45:37 -07:00
LGUG2Z 0b17aae86b fix(border): leave the border of a ghosted window to the animation
While a ghost stands in for a window the window is hidden and not where the
ghost is, and an animation moves its border along with the ghost. But the
border also follows the real window: every event komorebi handles ends with
a border update that reads the rect of the real window, and so does every
location change of it, and komorebi's own cloak, uncloak and resize of the
window produce both. Each of them put the border where the window is going to
be, or was, for a frame, until the next frame of the animation moved it back:
the border jumped ahead of the window, by as much as the whole width of the
screen when moves overlapped.

Say which windows a ghost stands in for, from when the ghost is made until it
is gone (or the animation is cancelled), and leave the borders of those to the
animation.

Recorded over 16 moves of mixed pace, a border was moved by something other
than its animation 21 times before; on a swap in the right column, 6 times
before (up to 127px off) and none after.
2026-10-30 15:45:37 -07:00
LGUG2Z 94cd37f6d0 feat(animation): show ghosts as a still picture on one shared host window
A ghost was a live thumbnail of its window, so it showed whatever the window
painted: the stretched old frame, then the blank frame a window paints while
it lays itself out again (Explorer shows its toolbar and nothing else for a
few hundred milliseconds), then the new layout, replacing the picture all at
once after the animation was over, and it stayed on screen about 300ms past
the end of the move while it waited for that. Every ghost also had a host
window of its own that was moved with SetWindowPos on every frame through a
channel to a thread that polls for commands every 8ms.

Take a picture of the window with PrintWindow before anything is done to it
(cropped to the visible frame, with the corners rounded) and show it through
a cloaked window of our own that DWM can take a thumbnail of and scale on the
GPU. All ghosts are composed onto one layered, click-through host window that
covers the virtual screen, and is only above other windows while a ghost is
alive so that it does not get in the way of the taskbar's auto-hide:
animating a ghost is one DwmUpdateThumbnailProperties call on the animating
thread, which has no thread affinity. The number of registered thumbnails is
counted and traced so that a leak of compositor handles can be seen.

The real window is cloaked and resized at the start of the animation, on a
thread of its own, and asked to paint itself at its new size straight away
(taking a picture of it makes it render synchronously) while the ghost is on
screen, so that it has the whole animation to lay itself out unseen. At 55%
of the way through, the window is shown again under the ghost (with the one
pixel size change that windows which render through a swap chain need for
their compositor to rebuild its render target) and the ghost fades out over it
while still moving, so the picture dissolves into the window instead of being
replaced after. A window that is slow to take its new size is not waited for:
it is shown once it is ready, or, if the animation ends first, waited for with
the ghost over it and then faded out over a few frames. Windows that are
minimized or gone are not ghosted.
2026-10-30 15:45:37 -07:00
LGUG2Z b50e21e5cd feat(animation): run the movement animations of a layout pass together
Each window that moved in a layout pass was animated on a thread of its own,
each preparing itself, drawing its frames and finishing by itself, so the
windows of a swap could be a little ahead of or behind one another, and a
ghost could appear over its window noticeably later than the ghost of the
window it was swapped with.

Collect the animations started while a workspace is being updated in an
AnimationBatch and run them on a single thread: they are prepared at once, so
that starting takes as long as the slowest of them (a ghost takes a picture of
its window) and not as long as all of them, every one is prepared before the
first frame, every frame of all of them is drawn before the compositor is
asked to present it (waiting for it with DwmFlush when a ghost is being
animated), and they finish and fade out together. Animations cancelled by a
newer one still drop out one at a time, and the wait for a cancelled one to
stop is checked every 4ms instead of every 125ms: it notices once per frame,
so the longer wait only delayed the animation replacing it.
2026-10-30 15:45:37 -07:00
LGUG2Z e3dd3c60de fix(scrolling): refocus after a window is closed with Hide
Closing a window sends Hide and not Destroy to many applications. The Hide
arm re-tiled without asking Windows to focus the surviving window, so no
window had the foreground and the border did not follow focus. Use the
same refocus rule as the Destroy arm.
2026-10-30 15:45:37 -07:00
LGUG2Z ae8e982380 fix(scrolling): show every window when a stack is spread out into a column
Spreading a stack out into a column left two things wrong, both seen in a
recording of toggle-column-stack:

- The window that stays in the original container was never restored. When it
  was the tab at the back it stayed cloaked, and its column was empty until
  focus reached it. Only the windows that moved to new containers were
  restored.
- Each new container took focus when it was inserted, so the strip scrolled a
  column to bring it into view, and did not scroll back once the containers
  were put in the one column again. The strip was left a column to the left,
  with an empty third of the screen. Focus now stays on the column that they
  are put in.

Test both, with windows that are hidden as stacking hides them.
2026-10-30 15:45:37 -07:00
LGUG2Z 5daca12e28 feat(scrolling): support more than one monitor
Remove the single-monitor restrictions on the Scrolling layout. Each
workspace keeps a strip of its own, and a window is seen on whichever monitor
it overlaps, so placement now looks at the other monitors: a window that
scrolled out of view past an edge that another monitor is next to is hidden
instead of parked, and a partly visible one is cut down to its own work area.

A window that comes back into view is shown again first, but only the one at
the front of its container: the others are the tabs at the back of a stack,
which are hidden because they are at the back.
2026-10-30 15:45:37 -07:00
LGUG2Z b8a444df5c docs(scrolling): describe the scrolling layout 2026-10-30 15:45:37 -07:00
LGUG2Z e8364f7b5b feat(scrolling): rest windows that scroll out of view at the edge
A window that scrolls out of view comes to rest at the edge of the work area
that it left by, with 5 pixels of it still on screen, keeping its size so that
nothing is resized to bring it back and an animation back into view is short.
Reuses the existing movement animations.

Also test the Workspace glue: widths, consume, expel, moving a column, and
that retile forgets the widths that windows were found to refuse.
2026-10-30 15:45:37 -07:00
LGUG2Z f170e8e2ac feat(scrolling): make room for windows that will not get as narrow
After windows are placed, ask each how wide it really is. A window that is
wider than its column was made to be widens the column to fit, and the columns
after it move along. A column never gets narrower again because of this, and
never wider than the screen.

What a window says about its size is only used once it can be trusted: with
synchronous window handling and no animation in flight, and for an overhang
of more than 16px, so that rounding, a terminal's cell grid, or a window that
is still moving does not widen a column for good. Adopting a width is logged
at info level.
2026-10-30 15:45:37 -07:00
LGUG2Z 7c79625ba7 docs(schema): regenerate the schemas for the scrolling layout
schema.json gets the center_focused_column layout option as a boolean or one
of Never, Always and OnOverflow, and schema.bar.json, which embeds the socket
messages, gets the new scrolling commands.
2026-10-30 15:45:37 -07:00
LGUG2Z 598390d9cb feat(scrolling): add commands and config for the scrolling layout
Focus, move, resize, retile and closing a window now go through the strip of
columns in the Scrolling layout. New commands: consume, expel,
toggle-column-stack, scrolling-layout-full-width and center-focus. A top
level scrolling section configures centering, centring a lone column, and
the minimum height of a window in a column of several.
2026-10-30 15:45:37 -07:00
LGUG2Z 8c7327fd31 feat(layouts): share the platform-free half of the scrolling glue
komorebi-layouts now carries what a host needs of the Scrolling layout
without touching an operating system: the scrolling config section and its
checked settings, the layout options for the model, placement of containers
in a work area, resizing a column or tile, and the hand-over of column
records between workspaces. It re-exports the model as
komorebi_layouts::scrolling::model, so komorebi-for-mac can pick all of it up
through its existing komorebi-layouts git dependency.

Also add the Workspace methods for columns, consume/expel/stack, focus and
ordering, which sit on top of it.
2026-10-30 15:45:37 -07:00
LGUG2Z 3b93035d48 feat(scrolling): lay out the scrolling layout with the scrolling model
The Scrolling layout now keeps a ScrollingSpace per workspace, keyed by
container id, instead of recomputing equal-width columns from the previous
layout on every update. Column widths follow layout_options.scrolling.columns
and persist as windows come and go.
2026-10-30 15:45:37 -07:00
LGUG2Z 6c4eb621d3 feat(scrolling): add a platform-free model of a scrollable strip of columns
Ported from komorebi-for-mac (feature/moar-scrolling). The crate has no
dependencies and no knowledge of windows; it is not used by komorebi yet.
2026-10-30 15:45:37 -07:00
LGUG2Z a4e03e3d76 test(resize): cover the top edge of the lower tile of a BSP layout
Dragging the edge two stacked tiles share moves it by the same amount from
either tile, in the layout and in the window manager. A drag of the top edge
of the lower tile that moves nothing is not for want of this.
2026-10-30 15:45:37 -07:00
LGUG2Z dc9b2e9539 fix(window): uncloak the windows a killed daemon left cloaked
A daemon that is killed does not get to uncloak the windows it hid, and the
next one skips them as cloaked, so they stay out of sight and unmanaged.

A cloak by komorebi reads the same as one for another virtual desktop or a
suspended app, so keep a record of the windows that are cloaked and uncloak
those that the last daemon left behind, before looking for windows.
2026-10-30 15:45:37 -07:00
LGUG2Z b80c18a9be docs(scrolling): the scrolling suite has run, and what no VM check covers 2026-10-30 15:37:53 -07:00
LGUG2Z e8963aee21 docs(behaviour): the differences kfw has with kfde, as known 2026-10-30 15:37:53 -07:00
LGUG2Z 79b0f4dc91 test(nix): rest by cells at the left edge in the scrolling suite
foot rounds its frame to whole cells, so a window the daemon rests with
five pixels showing can end a pixel short of the screen edge. Accept a
frame whose right edge is within the platform's tolerance of it.
2026-10-30 15:34:57 -07:00
LGUG2Z 76c97fb4e1 docs(scrolling): the scrolling layout, and what changed in the design docs
docs/usage/scrolling-layout.md says how the columns work. The design docs
say what the strip is, where a window out of view rests, and that the
generated tables of COMPARE.md are to be made again.
2026-10-30 14:44:54 -07:00
LGUG2Z e42a86454c test(nix): the commands of the columns of the scrolling layout
The scrolling suite checks where a window out of view rests, which is at the
edge it left by with a few pixels on the screen, and runs pan, consume,
toggle-column-stack, expel and scrolling-layout-full-width. They are not in
the shared scenario, which komorebi for Windows runs too, and has them only
on its next branch. Not run: the VM suites are for a later run.
2026-10-30 14:44:54 -07:00
LGUG2Z 555e2e97da docs(schema): the schemas and the command help for the scrolling layout
schema.json gets center_focused_column as a boolean or one of Never, Always
and OnOverflow, the options of the module follow it, and docs/cli has the
new commands.
2026-10-30 14:44:54 -07:00
LGUG2Z db976212b1 feat(scrolling): lay out the Scrolling layout with the scrolling model
The workspace keeps a ScrollingSpace of komorebi-scrolling, keyed by the id
of each container, in place of recomputing equal columns from the last
layout. A column can hold several windows. New commands and messages:
consume, expel, toggle-column-stack, scrolling-layout-full-width,
center-focus, expand and pan. Focus, move, resize, retile and closing a
window go through the strip, and a drag of an edge keeps it with the rest
of what the drag started from.

A window that is out of view rests at the edge it left by, with 5 pixels of
it on the screen and its size unchanged, and is hidden where another
monitor is next to that edge. A window that will not get as narrow as its
column widens the column, at the first layout after the windows have had
400 ms to draw. center_focused_column is Never, Always or OnOverflow, and
still reads a boolean.
2026-10-30 14:44:54 -07:00
LGUG2Z 3f51b3a0ca build(repo): take the scrolling model from upstream's next branch
komorebi-layouts and komorebi-themes move to the revision of next that has
the platform-free half of the rework of the Scrolling layout, and
komorebi-scrolling, the model of a strip of columns, is a dependency of
komorebi at the same revision.
2026-10-30 14:44:54 -07:00
LGUG2Z b86aa6fb78 docs(scrolling): review of upstream's rework of the Scrolling layout
For each commit of master...next that touches the layout: what it changes,
whether kfde takes it, and why not where it does not.
2026-10-30 14:44:54 -07:00
LGUG2Z d205320d64 docs(repo): KDE pads every monitor to the same number of workspaces 2026-10-30 14:44:33 -07:00
LGUG2Z 6190a4ad84 fix(nix): monitors reads the workspace counts when it needs them 2026-10-30 14:44:33 -07:00
LGUG2Z a2897edd12 docs(repo): a title change does not re-evaluate a window, as in kfw 2026-10-30 14:12:26 -07:00
LGUG2Z 3830bb27e9 feat(nix): title_rule asserts what kfw does: a rule decides when a window opens 2026-10-30 14:12:15 -07:00
LGUG2Z 84080f879e fix(wm): a title change does not make the daemon look at a window again 2026-10-30 14:12:15 -07:00
LGUG2Z 4920650155 fix(nix): the shared core: neutral names, E2E_ONLY, waits and diagnostics 2026-10-30 14:07:21 -07:00
LGUG2Z 225bf22a07 fix(nix): KWin is asked for the outputs once a second, and longer timeouts 2026-10-30 14:07:21 -07:00
LGUG2Z 3ef5f8279f docs(repo): the Windows displays and the Rect naming, from kfw 2026-10-30 13:20:41 -07:00
LGUG2Z c71c8fd013 fix(nix): the monocle check and the fakes, after merging the agents 2026-10-30 12:56:48 -07:00
LGUG2Z 86cf814f92 feat(nix): a crashed daemon leaves nothing hidden, as a shared scenario
Platform.crash kills the daemon abruptly. lifecycle_hidden.crash turns a
monocle on, crashes, starts the daemon again, and checks that it manages
every window, that none is left out of sight, and that a monocle works
again. The KDE extra parking keeps the stale parking desktop checks.
2026-10-30 12:53:28 -07:00
LGUG2Z cb134e7908 feat(nix): fullscreen and the user's maximize are shared scenarios
Platform.fullscreen and Platform.user_maximize take a window fullscreen or
maximize it as the user would, without asking the daemon. The scenarios
maximizing.user and fullscreen check that the daemon takes the window out
of the layout, leaves it alone, and puts it back. The KDE extras keep the
on-top screenshot, the daemon's log and the setup.
2026-10-30 12:53:27 -07:00
LGUG2Z 595706d66f feat(nix): the drag-resize edge cases are a shared scenario
resize.edge_cases makes its drags from the daemon's layout and reads the
frames from the operating system: both sides of a shared edge, a horizontal
edge, a corner and an edge of the screen, with a neighbour or without. The
KDE extra keeps pointer_is_exact.
2026-10-30 12:53:13 -07:00
LGUG2Z 4db3f97e2e feat(nix): the display_change scenario, and resizable_display
A display whose mode changes: the daemon's monitor follows, the windows
stay on a display and apart, and changed back they are where they were.
Platform.resizable_display says which display can change its mode, or None
and the scenario is skipped; KDE says None, as the virtual outputs of the
headless KWin have one mode. Platform.resize_display changes the mode.
2026-10-30 12:53:13 -07:00
LGUG2Z 3beb1b82d9 feat(nix): a window the user moves to another display is a shared scenario
hotplug.user_move moves a window with Platform.move_window to the second
display and checks that the daemon has it on that monitor and every window
is tiled on its display. The KDE suite runs it before the unplug and after
the replug, and the extra sent_by_the_user is gone.
2026-10-30 12:52:51 -07:00
LGUG2Z d14ce4d2e7 feat(nix): monocle focus behaviour is a shared scenario
monocle.focus_behaviour checks that with no-op the window keeps the work
area when the focus is moved in a direction, and with cycle another window
gets it. The KDE extra monocle_focus_behaviour is gone.
2026-10-30 12:52:22 -07:00
LGUG2Z 19c71eef9e feat(nix): named workspace rules and cleared rules are in the shared scenario
The shared rules scenario sends a window by the name of a workspace, checks
that a rule that is not initial is applied again when a window opens, and
that the daemon's global state has no rule after clear-all-workspace-rules.
The KDE extras keep the desktop numbers.
2026-10-30 12:52:21 -07:00
LGUG2Z f2a5c234e1 feat(nix): placement by the class of a window is a shared case
The shared placement scenario opens a window with a class and a rule that
puts the windows of that class first. The KDE extra by_app_id is gone;
by_program (foot.exe) stays.
2026-10-30 12:52:21 -07:00
LGUG2Z fec9b1e3da feat(nix): the query scenario is shared and asserts values
Each komorebic query is compared with the daemon's state, before and after
a change of focus and layout, and a resize that was saved is undone by
loading it, with quick-save-resize and with save-resize. Platform gets
temp_path for the file of save-resize.
2026-10-30 12:52:20 -07:00
LGUG2Z dc710ce419 feat(nix): every layout is tried with three, two and one windows
commands.layouts and layouts.run close windows from the end and open them
again with their own titles. The KDE extra layouts_by_count keeps only what
reads the daemon's log: KWin has each window where the daemon last asked.
2026-10-30 12:52:20 -07:00
LGUG2Z 7d32b02ec8 feat(nix): the handover scenario is shared
minimize, unmanage and manage on the focused window now run through the
neutral platform. The check that the unmanaged window is centered is
neutral: inside the work area and not on a tile of the layout.
2026-10-30 12:52:20 -07:00
LGUG2Z 8b64b3373a feat(nix): the title rule scenario is shared, and a window can rename itself
Platform.spawn takes rename_to and after: the window gives itself another
title after some seconds (a terminal escape on KDE). The scenario ignores a
title, and checks that the window is left alone while it has it, and tiled
once it has another.
2026-10-30 12:51:41 -07:00
LGUG2Z 26b4ff931b docs(repo): the ledger and the scenario table for monitors and layout_flip
Both are new shared scenarios and have not been run on a real KWin or Windows
guest yet, so their columns say so.
2026-10-30 12:51:06 -07:00
LGUG2Z b8be236f98 feat(nix): the layout_flip scenario, shared by both ports
Starts the daemon with the layout_flip option of a workspace set to each value
it takes, over columns, rows and BSP with two and three windows. Checks the
mirror from the OS, that flip-layout turns the option off and on, that a command
adds the other axis, and that the option is the named workspace's own.

core-e2e runs it after startup_rules.
2026-10-30 12:51:06 -07:00