enforce_resize_for_right_vertical_stack said "Zero is actually on the right"
but locked top, bottom and right of resize_dimensions[1], so the main
container (index 0, drawn on the right: arrangement.rs primary_left =
area.right - primary_width) was never constrained and the first stack
container could not be resized at all. Index 0 now loses top, bottom and
right (it can only grow to the left); the stack loop over [1..] is unchanged
(nothing in it goes left, first not up, last not down).
The test that pinned the buggy result is replaced by the previously ignored
test of the intended behaviour, un-ignored and extended to 1 to 4 tiles:
[l, rb], [l, rb, tr], [l, rb, trb, tr].
BEHAVIOUR (all three daemons share this function): resizing in the
right-main-vertical-stack layout changes. Gate: Windows e2e resize
scenarios; the ones that run in right-main-vertical-stack are none by name
(resize_commands uses the default layout; layouts.py and commands.py only
tile and cycle through right-main-vertical-stack), so a pointer or
resize-edge scenario in that layout would need adding.
Verified: cargo test -p komorebi-core, with and without --features schemars,
all pass; no e2e run.
wip-u-coretests (written against the hook's old name after_floating_removed) and wip-u-core4 (which renamed it to before_floating_removed because it runs before the window leaves the ring) were merged in candidate 5; the stub platform and the expected hook logs now use the new name. No behaviour change: the order test already pinned 'before the removal'. Verified: cargo test -p komorebi-core (with and without the schemars feature).
Candidate 5: wip-cand4 plus kfw's review fixes (wip-u-fix5: revert of the subscriber write timeout and the hwnd writer thread, BAR_RUNNING tied to the message, dead-window HIDDEN_HWNDS cleanup, core in default-members), kfm's macOS registry fixes (wip-u-kfm3), kfde's hook rename and per-pass title-bar snapshot (wip-u-core4), the komorebi-core characterization tests (wip-u-coretests) and the docs (wip-u-docs). Conflicts, if any, are resolved here.
Review finding 3. crates/komorebi-core was a member but not in default-members,
so a bare cargo test or cargo clippy at the root did not build it and its tests
(27, 30 with the schemars feature) never ran in the Windows set. komorebi-daemon
was already in the list. cargo test -p komorebi-core passes with and without
--features schemars: komorebi-layouts keeps Layout::Custom without the Win32
dependency, so no cfg needed fixing. (The komorebi-config crate prints an
unused-import warning of its own when built alone with default-features off,
pre-existing and not an error in the workspace build, where features unify.)
Verified: cargo test -p komorebi-core: 27 passed; with --features schemars: 30
passed; tools/fast-check (native, Windows clippy -D warnings, KDE, macOS) PASS.
docs/dev/macos-handcheck.md: a prioritised section with the independent review's twelve
hand checks and their exact steps (hide spot on the right display, event
latency with a stopped app, native tabs, floating and monocle, scrolling, config
reload, old state with the bar, pause and quit, bar config, unsupported commands,
registry growth, hung subscriber), a row for the wip-u-kfm3 registry fixes, and
a known-issue note: a subscriber that stops reading can stall the daemon (the
push writes under the window manager lock with no timeout; pre-existing and
the same in the original). A write timeout was deliberately not added: the
Windows review found it can truncate the JSON notification and does not bound
the stall, so the fix is a design, not a timeout.
ax_registry.rs module docs: when an entry is created (when the observer is
attached), the inert application, where it ends (the reapers, application
quit), why not in Window::drop, and what is not enforced (an observed
window that closes without passing through the reapers keeps its entry until its
application quits; cost and the unverified Mach-port question).
Verified: fake-CC cargo clippy --locked -p komorebi-macos --all-targets -D
warnings clean; tools/fast-check --since wip-cand4: native, Windows clippy, KDE
check + lib tests, macOS PASS; cargo test -p komorebi-core -p komorebi-backend
pass. Not verified: any run on macOS.
docs/dev/core-model.md section 19: remove_floating_window's hook is
before_floating_removed (behaviour unchanged), and the Windows title-bar
tables are taken once per pass through begin_pass; the sentence of
section 16 that called the per-container read an improvement is
corrected.
Verified: not applicable (documentation).
Follow-up to the review of komorebi-core (S/review/core.md, F2 and F4 and its
untested-behaviours list); most of the list was already pinned, this adds the rest:
- the after_floating_removed hook is pinned to run BEFORE the window is taken out
(it sees both windows and the old focus index), today's KDE/macOS order, although
the trait doc says after; the stub now logs len and focus for the hook.
- resolve_placement_index with Rules maps (Single and Many matching, Secondary,
no match falls back after the focused container); the stub gained a match id and a
path (a window without a path never matches Rules: it falls back).
- the JSON key set of a default workspace, and of Windows and macOS monitors per extra.
- the documented defaults of every optional hook on a platform that overrides nothing
(the KDE-shaped test platform), and that the default place hooks make update_shared fail.
- Monitor remove_workspace_by_idx at the length, and an old monitor file with a
non-empty ring of workspaces missing optional keys.
Verified: cargo test -p komorebi-core 215 passed, 1 ignored (the known bug), and with
--features schemars 217 passed, 1 ignored; clippy --all-targets has no warning in the
crate. No non-test source changed.
The root CONTRIBUTING.md is only the licence terms and did not say where the
layout and the build commands are. It now names docs/dev/ARCHITECTURE-UNIFIED.md
and docs/dev/build-and-test.md. Docs only, nothing built.
Review finding 5. WindowsBackend::live() failed with WindowGone before
Window::hide, restore, maximize and unmaximize ran, so the bookkeeping those
do to HIDDEN_HWNDS never happened for a dead handle: restore, maximize and
unmaximize always removed the handle from the list (original behaviour), and
a handle hidden before its window died stayed in the list for ever (the
reaper's cache and the border and layout code read it). live() now removes the
handle (forget_hidden, a pure helper) before it returns the early WindowGone,
which callers that need it still get. Every backend operation goes through
live() (hide, restore, minimize, unminimize, maximize, close, raise, focus,
set_rect), so every path cleans up. A hide of a dead window no longer pushes
the dead handle into the list, which the original did and nothing ever removed.
Tests: forget_hidden (pure, native logic) and live() on a handle that is not a
window; they compile here (clippy --all-targets passes) but the Windows crate's
tests cannot run on this host: NOT run.
BEHAVIOUR: dead-window cleanup only. e2e: lifecycle_hidden, commands.
Verified: Windows clippy -D warnings via tools/fast-check PASS.
Pins the cost rule the macOS fix depends on: Registry::insert of a new id runs no
handle's drop, a replaced handle is handed back and dropped only when the
caller drops it, get drops nothing, and remove hands the handle back. A probe
handle counts its drops.
Verified: native cargo test -p komorebi-backend: 40 unit, 7 doc, 1 compile_fail
passed, 0 failed.
BEHAVIOUR (Windows runtime): restores the original read of the title-bar
tables. WindowsPlatform::begin_pass takes REMOVE_TITLEBARS, NO_TITLEBAR
and REGEX_IDENTIFIERS once per placement pass (after the layout is
computed, as the old pass loop did) and place_container reads that
snapshot from Placement::pass, instead of locking and cloning the two
tables for every container, where a configuration reload in the middle of
a pass could give two containers two tables. Reviewer finding F3
(Windows review finding 6).
Windows e2e scenarios needed: layouts, stackbars and title-bar scenarios
(remove-title-bar, toggle-title-bars, no_titlebar rules), config_reload
(a reload while windows are being placed).
Verified: Windows clippy --locked --all-targets -D warnings: PASS; KDE
cargo test -p komorebi-linux (lite env): 664 passed, 0 failed; macOS
fake-CC check: PASS; komorebi-core tests: 30 passed. Not run: Windows
tests, e2e.
tests/state_roundtrip.rs (15 tests) reads the monitors of the e2e fixtures
(Windows kfw-tiled, kfw-stack, kfw-float; KDE kfde-tiled, kfde-stack) into the
shared Monitor<P> with a platform shaped like each daemon (Windows: isize id,
optional serial number, the name/device_id/workspace_names extra; KDE: u32 id,
string serial number, no extra; macOS: window_hiding_position extra), writes
them again and compares the parsed JSON: every fixture is written as it was
read. Also pins that the corner is the last macOS monitor key and cannot be
omitted, that the workspace keys are the same whatever the platform, the exact
set of KDE monitor keys, and which keys an old state file may omit (23 optional
keys at monitor, workspace and container level, e.g. container locked and
workspace layout_options_rules) and which it may not (18 required keys,
including layer, work_area_offset_rules and apply_window_based_work_area_offset:
a file from before those existed does not load; pinned, not judged).
The fixtures are copied into tests/common/fixtures.rs as Rust text because the
nix source filters keep .rs files and drop .json; a test compares the copies with
e2e/lib/tests/fixtures when the checkout has them. The macOS fixture is NOT real
macOS output: it is kfde-tiled reshaped with jq to the macOS window and monitor
shape of the state_pin tests (no Mac here), and says so in its comment; replace
it with 'komorebic state' from a Mac when one is at hand.
Verified: cargo test -p komorebi-core (27 unit + 179 integration passed, 1
ignored) with and without --features schemars; cargo clippy -p komorebi-core
--all-targets has no warning in the crate. Windows clippy and macOS check not run:
the tests are portable crate tests and no platform source changed.
One page with the exact commands for each platform, so nobody has to
reconstruct them from the flakes and the progress notes:
- Windows: nix cross build of the binaries, the crane checks (clippy is the
pre-landing gate), the e2e-tests check, native tests of the neutral crates;
- KDE: cargo check/test with the right package names (the unit tests are in
komorebi-linux, not the thin komorebi binary package), the schema test with
one thread, the kfde-* checks of the root flake, the VM suites with `just vm`,
the tier lists, E2E_ONLY and KOMOREBI_RECORDER for VM runs;
- macOS: cargo build/test/clippy with `-p komorebic -p komorebi -p komorebi-bar`,
never `-p komorebic-macos` together with `-p komorebic`, and the Linux-only
type-check;
- Windows e2e: `nix run .#e2e-windows`, the `bar` scenario, E2E_ONLY, trace,
recorder, KEEP_GUEST, SCALE, STATE, bins from another commit;
- a what-to-run table and the known flakes with counts, summarised from the
flake registry kept by the gate runs (no personal paths).
It also records that komorebi-for-kde/justfile still assumes a KDE-only
workspace (`just check` would build the Windows crates).
Verified by running: `cargo metadata --no-deps` (package names), `cargo check
-p komorebi-linux -p komorebi -p komorebic` in komorebi-for-kde (ok), `nix eval
--json .#legacyPackages.x86_64-linux.vmTiers` (the tier lists match). Other
commands were read from flake.nix, justfiles and the e2e README, not run.
Reverts 3d2386e3 (review finding 8). The detached latest-wins writer thread
left the file lagging behind the daemon (a command that returned, or stop, could
precede the write, and std::process::exit cut a write in progress), and it
opened and truncated the file in place, so a reader could see it half written.
The file is small and the synchronous write was the original behaviour; the
stall analysis did not show it to be a cause of any hold (the per-step and
lock-holder instrumentation of the same stack will show whether it ever is).
Restoring the synchronous write in update_known_hwnds and the reaper is the
simplest form that is correct: the file is complete when the command returns
and when stop exits.
Behaviour is the original again for the file. Verified: Windows clippy
-D warnings via tools/fast-check PASS; e2e: lifecycle and commands (the file is
written again before the reply).
BEHAVIOUR (registry only). Review finding 4, the part that can be done where a
window id is known.
Window::observe now registers the windows that are really observed (previous
revision), and a window that closes while its application runs left its entry
until the application quit. WindowManagerEvent::Destroy carries no window id,
but reap_invalid_windows_for_application is where the daemon works out which of
the application's windows are gone, and it already removes them from the
workspace: it now also forgets them in the registry (tiled and floating
alike); the reaper's reap_window did already.
What stays: an observed window that closes without passing through either
(for example one that was unmanaged and then closed, or whose Destroy was not
followed by a reap) keeps its entry (an element, an observer and an inert
application) until its application quits; the table is bounded by the number
of windows the daemon has observed per running application, and a periodic
sweep would cost one Accessibility call per entry under the window manager lock.
Hand check H4 measures the Mach ports held (the one unverified cost: whether an
AXObserver holds a port).
Verified: macOS fake-CC type-check (tools/fast-check) PASS. Not verified: any
run. Verified on the Mini: not yet.
WorkspacePlatform::begin_pass(workspace) is called once per placement
pass, after the layout is computed and before the containers are placed,
and what it returns is handed to adjust_layout and place_container as
Placement::pass (Placement now carries that borrow). A platform that has
something to read once for the whole pass takes it here, so that two
containers of a pass cannot see two different values. The default returns
None. A test with the stub platform pins the order (once per pass, before
the placements) and that the hooks see the answer.
For reviewer finding F3 (S/review/core.md): the Windows title-bar tables
were read once per pass and the shared update read them once per
container; the Windows revision that follows uses this hook.
Verified: cargo test -p komorebi-core --features schemars (native): 30
passed, 0 failed. Not run: the daemons (the next revision builds them).
tests/monitor_workspaces.rs (22 tests) over the recording stub platform:
ensure_workspace_count (grows with default workspaces, never shrinks, leaves
the focus), focus_workspace (last_focused_workspace bookkeeping including
focusing the focused one, creating every workspace up to a focused index past
the end, the empty monitor), the known workspace name (without a known name
names stay; with one only the focused workspace takes it, and an EXISTING
workspace's name is overwritten at every focus although the comment says
only at creation: pinned as it is, inherited from the Windows tree),
remove_workspace_by_idx (index not moved, past-the-end focuses idx-1 creating
workspaces, empty monitor gets a default one), remove_workspaces, add_container
with and without a workspace index and the error cases, the focused layout
only while tiling, and the JSON of last_focused_workspace and a round trip.
Verified: cargo test -p komorebi-core --test monitor_workspaces, 22 passed.
No non-test source changed.
A new reader had no single page that said where things are: three platform
trees, nine shared crates, the four unified packages, the shims that remain,
and which differences are on purpose. The page gives:
- the three trees and what lives in each (root = Windows, komorebi-for-kde,
komorebi-for-mac) and that the root Cargo.toml is the only workspace;
- the packages komorebi (komorebi-daemon, cfg_select! over komorebi-windows,
komorebi-linux, komorebi-macos), komorebic, komorebi-client, komorebi-bar
and their cfg(target_os) layout, and the shim packages until the cutover;
- the crates/ map (protocol, config, collections, transport, backend, core,
settings, bar-core, komorebic-core);
- where the platforms differ on purpose, with a pointer to seam.md,
core-model.md, settings.md, unified-binaries.md, bar-unification.md and
macos-handcheck.md;
- the oracles (wire goldens, config and bar schemas, CLI docs, derivation
drift) and the tiered feedback loops;
- the tools outside the repository (fast-check, mac-check.sh,
kde-closure-check, e2e-needed, gate-lock, ...) with a proposal of which to
commit; nothing was moved.
Statements were checked against Cargo manifests (cargo metadata --no-deps
lists the package names used), flake.nix and the source directories. The
version numbers and the packages list were read from manifests. Not built;
macOS statements are what the progress log says, not observed.
Review finding 4 on the stall fix.
- BAR_RUNNING was a process-wide static written by on_message and read by
whichever replace-configuration ran next: a dropped message (paused, lock not
acquired) left a stale answer, and two connections overwrote each other. It
is now a thread_local Cell<Option<bool>>: the per-connection thread that
reads a message (on_message) and then handles it (inside try_lock_for) is the
same thread, every message read replaces the cell (None unless it is a
ReplaceConfiguration), and replace_configuration takes it. TCP clients never
set it and the handler scans for itself, as before.
- The bar section of the config is read before the thread is spawned and its
error is returned to the client as it was (the original read it after a
successful Stop-Process, which cannot fail differently: the same file was read
successfully at the top of the command); only the PowerShell work moves to
the thread (restart_bars takes the bar configuration, no longer a path).
- The restart thread's handle is kept in BAR_RESTART; finish_bar_restart() joins
it and is called before process::exit in WindowManager::stop and in the
ctrl-c path of daemon.rs, and by the next replace-configuration, so komorebic
stop (which stops the bars after the daemon is gone) cannot be followed by a
bar that the restart thread starts late.
BEHAVIOUR: as the earlier revision (the reply no longer waits for the bars), plus
stop now waits for a running restart. Gate needed: Windows e2e commands and
config_reload; manual: replace-configuration then stop with a bar running.
Verified: Windows clippy -D warnings via tools/fast-check PASS; e2e not run.
BEHAVIOUR (registry only). Review finding 3.
process_event returned at 'if self.is_paused' and at the space-id mismatch before
reaching the Destroy arm where forget_pid was, so NSWorkspaceDidTerminateApplication
seen while paused (a locked screen pauses, so does toggle-pause) or on another space
was discarded and the entries of that pid stayed for a process that reuses it.
The forget_pid call is now the first thing process_event does for that
notification, with a comment, and the Destroy arm keeps the rest as it was (the
enhanced-UI forget there is pre-existing and not moved). forget_pid takes only
the registry's own lock: it does not take the window manager lock or dispatch to
the main queue.
Test (Mac): forget_pid removes the windows of that pid and no others.
Verified: macOS fake-CC type-check (tools/fast-check) PASS. Not verified: any
run; a WindowManager-level test of the paused case needs the process_command.rs
harness and is left to the Mini. Verified on the Mini: not yet. Hand check: H6.
Workspace::remove_floating_window calls the hook before it takes the
window out of the ring (the KDE and macOS originals move the focus to the
previous floating window first, and the focus index moves back by one
whatever the length), but the hook was named after_floating_removed and its
doc said after. Name and doc now say before; the behaviour is the one KDE
and macOS had. KDE's and macOS's implementations are renamed with it (the
only users; Windows keeps the no-op default). A stub test pins the order:
the hook sees both floating windows when one is removed.
Reviewer finding F2 (S/review/core.md). No behaviour change.
Verified: cargo test -p komorebi-core --features schemars (native): 30
passed, 0 failed; KDE cargo test -p komorebi-linux (lite env): 664
passed, 0 failed; Windows clippy --locked --all-targets -D warnings:
PASS; macOS fake-CC check: PASS. Not run: VM suites, Windows e2e.
tests/update_shared.rs (34 tests) over the recording stub: the exact call log
for plain tiling (begin_update, containers_pruned with the old focus index,
adjust_layout then place_container per container, end_update with the around
and viewport arguments, guard dropped last), monocle (place_monocle with the
work area less workspace, container, border offset and border width padding;
no end_update), maximized, monocle beating maximized, scrolling (adopt widths,
scrolling_layouts, hidden flags into place_container, again), empty, tile off,
a skipped begin_update, end_update returning Again (pass numbers, the places
repeated, begin and prune once). Error policy per hook: begin_update,
place_container, place_monocle, maximize_in_layout and end_update errors all
propagate; the guard is still dropped; a failing place_container leaves
latest_layout and the resize vector untouched while a failing end_update has
already kept the layout. Also the layout rules (highest threshold wins and
sticks), container behaviour rules (none reached clears it), work area offset
priority (rule, workspace, monitor; monocle counts as one), the window-based
offset limit, paddings (workspace Some(0) wins over the monitor), resize vector
resizing (not while monocle) and constraint enforcement before layout.
Verified: cargo test -p komorebi-core --test update_shared, 34 passed. No
non-test source changed.
The documents in docs/dev were written at different points of the
consolidation and some of their statements are history (for example
unified-binaries.md still says "never write -p komorebi", true before step 8).
Each now opens with a "Status (wip-cand4)" line saying whether it is design,
evidence or a log, what has landed, what has not, and, for
unified-binaries.md, which part is superseded.
The statuses were taken from the revision list wip-main..wip-cand4 and the
progress log, not from re-measuring. Only the line under the title was added;
no existing text changed. Not built.
Reverts 4bdda86f. A write timeout can deliver a truncated JSON document: part
of the notification is written, the write then fails with TimedOut, and the
subscriber, which stays subscribed, reads the prefix followed by the next
notification. It also does not bound the stall: nothing evicts the subscriber
(each push to it waits another second under the window manager lock), the
connect has no timeout (uds_windows offers none), and that Winsock honours
SO_SNDTIMEO on AF_UNIX sockets is unverified. The transport change and the
Windows connect closure are both reverted, including the skip-on-timeout test
(the connect parameter of notify_sockets was already there and is unchanged).
Follow-up, not done: an eviction policy for a subscriber that does not take a
notification, together with a timeout that was verified on Windows (or a
non-blocking write with a per-subscriber queue). Decision D-coord-10.
Behaviour is back to cand4's predecessor (no timeout). Verified: tools/fast-check
(native, Windows clippy -D warnings) PASS; e2e not needed beyond commands.
BEHAVIOUR (registry only; the reaper notification that Window::drop already
sends is the pre-existing behaviour and is untouched). Review finding 2.
Window::drop runs for every clone, including the one State::from makes of each
window on every command and event notification, and alive() is false for any
failed Accessibility call (a busy or launching app, a modal animation). The
registry forget that the registry revision put there therefore made a
transient failure drop the entry of a live, managed window. It was redundant
with the places that really know a window is gone (reap_window, and forget_pid when
an application quits), so it is removed and a comment says why.
Test (Mac): registering a window and dropping a clone of it leaves the entry.
Verified: macOS fake-CC type-check (tools/fast-check) PASS. Not verified: any
run. Verified on the Mini: not yet. Hand check: H7, and H3 (kill -STOP an app,
focus around it: its windows must stay managed).
Candidate 4: wip-cand3c (core line with macOS on komorebi-core, HideSpot, settings S1-S3, bar e2e scenario, handover scenario fix), wip-u-core3 (shared Workspace update_shared and the Windows converge of window_manager/process_command), wip-u-stallfix (lock-holder instrumentation, sysinfo scan before the lock, bar restart and hwnd file off the lock, subscriber write timeout) and wip-u-pkg2 (one komorebi package and binary, daemons as libraries). Conflicts, if any, are resolved here.
tests/workspace_layers.rs (33 tests): monocle toggle, reintegration (index
restore, padding past the end), cycling and its wrap; new_floating_window from
a container, a stack, the monocle and the maximized window (unmaximize hook, the
failure leaving the window maximized); floating removal and the
after_floating_removed hook; the layer enum (default, Display, JSON) and that the
shared code never changes it; Workspace::hide order (floating from the back at the
window spot, containers at the display spot, maximized, monocle) with the error
policy: a floating or container window that will not hide is skipped, a maximized
one is an error that stops before the monocle.
tests/resize_constraints.rs (11 tests): the sides each default layout leaves
adjustable for 1..4 containers, None tiles, and no containers.
BUG FOUND (one ignored test): enforce_resize_for_right_vertical_stack indexes
resize_dimensions[1] where its own comment says zero is on the right, so the main
container is never constrained and the second may not be resized at all; this is
inherited unchanged from the Windows tree. The current behaviour is pinned by a
passing test and the intended one by an #[ignore = "bug: ..."] test.
Verified: cargo test -p komorebi-core --test workspace_layers --test
resize_constraints: 33 and 10 passed, 1 ignored. No non-test source changed.
COMPARE.md is a snapshot of kfw 173aa802 and kfm 125a9a5 (2026-10-27), before
the commands, messages and configuration types moved into crates/. Its
generated tables count duplicated definitions that no longer exist, and the
generator cannot read the new layout: running it against this tree
(`--kfw .. --kfm ../komorebi-for-mac --kfde .`) stops with "cannot find
^enum SubCommand" because the command definitions are in crates/komorebic-core.
Rather than regenerate tables that would be wrong, the document gets a STALE
banner naming the snapshot, the reason and where the current description is
(docs/dev/ARCHITECTURE-UNIFIED.md, core-model.md), and the script docstring
says it must be ported or retired. No tables were rewritten.
Verified: ran the script as above (fails as described); the script still
parses. Not built. Executable mode of the script is unchanged.
BEHAVIOUR (what is registered, and when; nothing reads the registry yet
except the unused MacosBackend). Review findings 1 (cost) and 6 (wrong
observer).
Window::new created a fresh AXObserver and registered the window each time,
so one event registered up to three constructions on the event thread under the
window manager lock (the attach-check, the re-check and the managed one), each
replacing the last, and the managed window's attached observer (the one
window.observe put on the run loop) was replaced by the third throwaway's
unattached one; window_by_title at start-up made n x n of them for an
application with n windows. Registration now happens in Window::observe, after
add_observer_to_run_loop succeeded: a Window made only to ask an app something
is never observed and never registered, the registry holds the observer that is
really attached, and a window is registered once (process_event.rs after
should_manage, and macos_api.rs at start-up). The decision is documented in
ax_registry.rs in the docs revision of this stack.
Verified: macOS fake-CC type-check (tools/fast-check) PASS. Not verified: any
run. Verified on the Mini: not yet. Hand checks: H3 (start-up with a many-window
app: time to ready), H7 (native tabs).
Gate candidate 3c: wip-cand3b (cand3 + the bar e2e scenario) plus wip-u-kdefix (handover precondition in both copies of the shared e2e lib, KDE vm-commands bring_back step). The shared e2e/lib handover scenario is also what the Windows runner runs, so the Windows gate must include it.
notify_subscribers connects to every subscriber socket and write_all()s the
notification with the window manager locked (every command, the reaper and
the event thread), with no timeout: a subscriber that stops reading stalls the
lock holder, and with it every thread.
komorebi_transport::notify_sockets skips a subscriber whose write fails with
TimedOut or WouldBlock (warns, keeps it subscribed, goes on to the next);
every other write error still aborts as before. The timeout itself is the
caller's: the connect closure passed by the Windows daemon sets a 1 s write
timeout on the stream. KDE and macOS pass connect closures without a timeout,
so nothing changes for them. A new unit test covers the skip. The connect
itself cannot be bounded (uds_windows has no connect timeout), and the
listener's lock wait is untouched.
BEHAVIOUR: a Windows subscriber that does not read for a second misses that
notification instead of blocking the daemon. Gate needed: Windows e2e commands
and config_reload, the lock stress, subscriber scenarios if any. Verified:
native cargo test -p komorebi-transport 14 passed (incl. the new test);
tools/fast-check native, Windows clippy -D warnings and KDE check + lib tests
PASS; macOS type-check run by hand (fast-check's macOS step fails to select
a package on this merged tree) PASS. e2e not run.
tests/workspace_containers.rs (41 tests) over the recording stub: where a new
window goes (empty, after the focused container, scrolling hook index,
preselection, every initial placement rule incl. the 1-based index and its
fallback), resize-slot bookkeeping on insert and remove, locked containers
keeping their index on insert, swap and promote, the note_scrolling_departure
hook before a removal, the focus index after remove_container (idx-1 of the
FOCUSED container, not of the removed one), stacking (move_window_to_container)
and unstacking with the exact hide/restore call order and the hide spot passed,
focus by window, window lookup across containers, monocle, maximized and
floating windows, location_from_exe order, visible_windows order, directions
with and without layout flip, cycling and the pointer lookup.
Verified: cargo test -p komorebi-core --test workspace_containers, 41 passed.
No non-test source changed.
The consolidation moved files that the KDE docs and a few comments name,
so about a dozen references were dead or wrong:
- docs/dev/ARCHITECTURE.md: `ring.rs` and `lockable_sequence.rs` are in
crates/komorebi-collections; the daemon `main.rs` is `daemon.rs` of the
komorebi-linux library; the KDE command line is
komorebic/src/linux/mod.rs and hotkeys.rs of the root komorebic package;
the tests that moved are komorebic/tests/linux_{check,cli,hotkeys}.rs,
komorebi-client/tests/linux_subscribe.rs and
komorebi-daemon/tests/linux_{socket,hot_reload}.rs.
- komorebi/src/check.rs (doc comments only), the VM `check` suite and its
library extra, docs/dev/scrolling-next.md: `komorebic/tests/check.rs` and
`cli.rs` are `linux_check.rs` and `linux_cli.rs`.
- CONTRIBUTING.md, Releases: the version is in komorebi/Cargo.toml (the
KDE tree no longer has a workspace manifest).
Text and comments only, no code. The edit of check.rs and of the VM files
changes the KDE derivations (acceptable for docs). Verified: a link checker
over komorebi-for-kde/docs/dev reports no dead relative link; the moved test
files exist and contain the two named test functions. Not built.
BEHAVIOUR (cost only; nothing reads the registry yet except the unused
MacosBackend). Review finding 1.
Application::drop does a blocking Accessibility round trip (is_valid ->
copy_attribute_names) when is_observable, and invalidates the observer that
every clone shares if that fails. AxEntry held a clone of the Application, so
every register (which drops the entry it replaces), forget and forget_pid ran
that call, on the event thread with the window manager lock held, and an
unresponsive app made it slow or made it invalidate the observer of a live
app. Window::entry() now stores Application::inert(), a clone with
is_observable false, whose drop does nothing, and Window::from_entry therefore
builds windows with an inert application as well (it only affects Drop).
Tests (run on a Mac; the flag is plain data and needs no Accessibility
permission): a registered entry and a window made from an entry have
is_observable false even when the window's own application is observable.
Verified: macOS fake-CC type-check (tools/fast-check) PASS. Not verified: any
run. Verified on the Mini: not yet. Hand check: H3 of docs/dev/macos-handcheck.md.
Scenario precondition fix for the vm-commands failure "[shared] win3 is inside the work area and
not on a tile of the layout" (see the previous revision for the log evidence).
The shared sweep sends windows to other workspaces (send-to-last-workspace and the like), so
by the time handover ran, win3 was alone on workspace 0 and win1/win2/win5 were parked on
workspace 3. New KDE step bring_back, between replace_configuration and handover: while another
workspace of the first monitor has windows, focus it and send-to-workspace 0, then focus
workspace 0 and check that it has two containers or more and is the focused one. The handover
check is untouched.
Native pytest of the VM lib: 320 passed; ruff check and format clean. The step itself only runs
in the VM.
VM verification: not yet (vm-commands on baseline-with-fix and candidate, ~20 min each, after the
KDE VM run).
update_known_hwnds (at the end of every command) and the reaper opened,
truncated and wrote komorebi.hwnd.json with the window manager locked. They
now hand the list to reaper::save_known_hwnds, which keeps only the latest
pending list and writes it from a thread of its own; errors are logged there
as before (the reaper no longer returns the write error).
BEHAVIOUR: the file is written a moment after the lock is released, not before
the command returns, and when several updates arrive together only the last
list is written. Nothing in the daemon reads the file. Gate needed: Windows e2e
commands, lifecycle, and the lock stress. Verified: Windows clippy -D warnings
via tools/fast-check PASS; e2e not run.
Adds crates/komorebi-core/tests/common (StubWindow, StubPlatform): a
Clone-but-not-Copy window and a platform whose window operations and every
WorkspacePlatform and MonitorPlatform hook append a line to an ordered log,
with failure injection per operation (fail("hide 3"), fail("place_container")),
scripted end_update passes and a per-workspace hide spot kept in the platform
state the way macOS keeps its corner. The log and settings are thread-local
and every test starts with fresh().
tests/container_behaviour.rs pins Container<W> (24 tests): add/remove/focus
ordering, the focus index after removal at each position (it is idx-1 whatever
was focused, and dangles after an out-of-range removal), empty-container cases,
the order of hide_window calls (from the back, a failing window is skipped),
load_focused_window stopping at the first failure, the omitted window, restore,
locking and the JSON shape.
Verified: cargo test -p komorebi-core --test container_behaviour, 24 passed
(nix shell gcc, own target dir). No non-test source changed.
replace-configuration ran the PowerShell that stops and starts komorebi-bar
(one to three powershell_script::run calls, each seconds) with the window
manager locked. The block is now fn restart_bars and runs on a thread of its
own, started after the new window manager is in place (the lock is released
when the command returns); its errors are printed as before, but no longer
returned to the client.
BEHAVIOUR: the command replies before the bars are restarted (a client that
waited for the bar to exist after replace-configuration must now wait for it),
and an error reading the config for the bar section is printed instead of
returned. Only affects a daemon that has a bar running. Gate needed: Windows
e2e commands and config_reload (no bar in the e2e), a manual check with a bar.
Verified: Windows clippy -D warnings via tools/fast-check PASS; e2e not run.
replace-configuration called sysinfo::System::new_all() and refresh_processes
under the window manager lock, only to know whether komorebi-bar.exe runs.
new_all reads memory and CPU (it opens a performance-counter query, slow the
first time), and for every process the command line, environment, owner and
disk usage. The stall analysis measured the first replace-configuration of
each e2e run holding the lock for about 3 s (17 of 17 runs).
Now: komorebi_bar_is_running() reads only the process names
(System::new + refresh_processes_specifics(All, true, nothing())), and the
connection policy runs it in on_message, i.e. before the window manager is
locked for a ReplaceConfiguration, and leaves the answer in a static for the
handler to take (the handler scans itself, names only, if the answer is
missing, e.g. the message came over TCP). The result is the same: whether a
komorebi-bar.exe process exists, now decided when the message is read rather
than after the new window manager is built.
BEHAVIOUR: the lock hold of replace-configuration shrinks (expected from about
3 s to the preload/init/reload cost); a bar started or stopped between the
read of the message and the end of the reload is not noticed. Gate needed:
Windows e2e commands and config_reload, the lock stress, and the sweep timing
(first replace-configuration, see the new per-step info lines). Verified:
Windows clippy -D warnings via tools/fast-check PASS; e2e not run.
Instrumentation for the stalls of the stall analysis; no behaviour change.
lock_holder.rs: a place that has just locked the window manager calls
lock_holder::held("site") and keeps the returned guard next to the lock
guard; the holder (what, thread, since) is recorded in a slot of its own
(a mutex held only for a copy; the window manager lock itself is unchanged),
a hold of 200 ms or more is logged at warn when it ends ("window manager
lock held by X (thread T) for N ms"), and lock_holder::describe() names the
holder for the waiters: the border manager's "stuck for N ms" warning and
the listener's "could not acquire window manager lock" warning now end with
the holder. Sites: every command (held as "command <message>"), process_event,
reaper, monitor reconciliator, border manager, transparency and stackbar
managers. komorebi-transport: ConnectionPolicy::lock_holder() (default None),
used in that warning; the Windows policy implements it, KDE and macOS keep the
text they had.
replace-configuration logs info lines "replace-configuration: <step> took N
ms" for restore, preload, init, restore of the new wm, reload, swap, the
process scan for komorebi-bar and the bar restart; every command logs at
debug how long the command, update_known_hwnds and notify_subscribers took.
Verified: tools/fast-check: native, Windows clippy -D warnings, KDE check +
lib tests PASS; the macOS step of fast-check fails to select a package on this
merged tree (tool issue: -p komorebi), the macOS check run by hand with -p
komorebi-macos -p komorebic-macos -p komorebi-client-macos -p
komorebi-bar-macos passes. Not run: e2e.
Scenario precondition fix; the check "the unmanaged window is inside the work area and not on a
tile of the layout" itself stays as strict as it was.
The KDE VM suite vm-commands failed it on a calm host, on the original komorebi-for-kde tip
(7d19fd40) and on the refactored stage alike, with the same numbers each time: work area
(0,0,1920,1080), layout a single tile (10,10,1900,1060), win3 at (10,10,1896,1050) (within the
24 px tolerance of that tile), win1/win2/win5 parked on workspace 3. After the sweep win3 was the
only window on its workspace. Unmanaging a lone window leaves it on the tile it was put on, and
an emptied workspace has nothing to calculate, so it keeps its last layout; "not on a tile" could
never hold. The scenario now checks first that the focused workspace has at least two tiled
containers and, if not, fails with a message that says so (and the describe() dump) instead of
the misleading unmanage failure. Windows runs handover as its own suite with its three tiled
clients on workspace 0, so the precondition holds there.
The same file lives in e2e/lib and in komorebi-for-kde/nix/tests/vm/lib; both are edited alike. A
fake-platform test covers the precondition; the existing handover cases still fail where they
should.
Native pytest of the VM lib: 320 passed; ruff check and format clean.
VM verification: not yet (vm-commands on baseline-with-fix and candidate, ~20 min each, after the
KDE VM run).
docs/dev/core-model.md section 18: the shared share of window_manager.rs
after the converge (26% identical with Windows, 37% within four lines,
63% differing or one-sided, so not above the 60% bar), a table of the
near-identical functions and why each is cosmetic or real (the Windows
handle_unmanaged_window_behaviour calls in 18 functions against the router
call on KDE and macOS, borders, floating windows in monocle, workspace
names, custom layouts, id types), the 25 differing router arms (two
converged, the rest real; FocusWorkspaceNumber(s) and FocusLastWorkspace
probably an omission on KDE), and the seven blockers.
Verified: not applicable (documentation); numbers from the function
comparison at this tip.
Gate candidate 3b: wip-u-cand3 (macOS on komorebi-core, HideSpot signature change, settings S1-S3) plus the Windows e2e scenario for the bar (wip-u-bar2: e2e/ files and the nix e2e app only). Conflicts, if any, are resolved here.
Merge of kfm's macOS core migration (wip-u-kfm2 9cb4f2fa) and the settings
stack through S3 (wip-u-settings2 696d2929), both on wip-u-integ2. Two files
conflicted, both macOS; every hunk is resolved the same way: take kfm's
version of the file (its new shapes: komorebi_core Monitor/Workspace,
workspace_config and monitor_config as free functions) and re-apply the S3
change to it, because the settings side only touched lines kfm moved.
- komorebi-for-mac/komorebi/src/monitor.rs: conflict 1 (imports): kfm's
header doc kept, the DEFAULT_CONTAINER_PADDING / DEFAULT_WORKSPACE_PADDING
imports dropped (S3). Conflict 2 (std imports): kfm's side (no VecDeque).
The four padding reads (the two default fallbacks in the monitor's
workspace globals) call crate::settings::container_padding() /
workspace_padding(); the now unused Ordering import is removed.
- komorebi-for-mac/komorebi/src/static_config.rs: both conflicts are the
padding defaults in kfm's free functions (workspace_config, monitor_config):
kfm's text kept, the two defaults read from settings. Re-applied S3 in this
file: apply_globals applies paddings, aspect ratio, layout_defaults and
display_index_preferences as one Handle::update of a SharedDelta; the
readers (layout_defaults, aspect ratio, display preferences, paddings) use
the accessors; the statics' imports and the now unused AspectRatio imports
are removed.
komorebi-core and the shared crates read none of the removed statics
(grep: only the unrelated DEFAULT_*_PADDING consts in komorebi-config), so no
hook is needed. S3 semantics are unchanged from wip-u-settings2 (statics
removed, one update per load, reload merges, a few keys reset); the pins
are the settings crate's reload.rs and shared tests plus the KDE
tests/config.rs.
Verified: see the run in the progress log (macOS fake-CC clippy -D warnings
-p komorebi-macos --all-targets clean at this revision).
BEHAVIOUR (log text only, nothing else expected): the Windows copy of
these functions is changed to the text KDE and macOS have where the two
do the same:
- eyre::bail! is written in full (the bail import goes), as in KDE;
- toggle_lock flips the flag through Lockable (set_locked/locked), as
in KDE, instead of assigning the field;
- the log line of maximize_window says 'maximizing window' (it said
'maximizing windowj') and the one of clear_workspace_layout_rules says
'clearing workspace layout rules' (it said 'setting workspace layout');
- the SessionFloatRules arm uses unwrap_or_else and the State arm names
State, which is the text of the KDE arms.
Nothing else of the 61 functions that differ by at most four lines is
the same behaviour: the rest are real differences (core-model.md section
18).
Windows e2e scenarios needed: toggle-lock, maximize, clear layout rules,
session-float-rules, state (all cheap).
Verified: Windows clippy --locked --all-targets -D warnings: PASS (after
touching the sources: the shared target dir had stale metadata). Not
run: Windows tests, e2e.
Step 8 (Option A of docs/dev/unified-binaries.md). The main.rs of komorebi-windows, komorebi-linux and
komorebi-macos becomes daemon.rs of the library (pub fn run; komorebi:: paths are crate:: paths now, the
inner attributes and the unit tests move with it), and their [[bin]] is gone, so each is a library only.
The new package komorebi (komorebi-daemon/, version 0.1.42) is the one binary: its main calls
komorebi_windows::daemon::run, komorebi_linux::daemon::run or komorebi_macos::daemon::run by cfg_select! on
the target OS, through target-gated dependencies (one key per library, cargo allows one path per key),
and forwards the features deadlock_detection and schemars. The binary name komorebi now comes from exactly
one package. The four KDE integration tests that run the binary (no_kwin, socket, hot_reload, version)
move to komorebi-daemon/tests/linux_*.rs; the version test compares with the KDE version crate, since
the package version is now shared. Old names: komorebi-windows, komorebi-linux and komorebi-macos still
build, as libraries (no binary any more: use -p komorebi). The flakes build -p komorebi with the KDE and
macOS packages, the source filters take komorebi-daemon (manifest, main.rs, linux tests), the Windows
filter leaves its linux tests out, deny.toml clarify entries gain komorebi, the release workflow's cargo wix
and the justfile version lookup name komorebi, tools/fast-check checks -p komorebi on KDE and macOS.
Behaviour: the same code runs, the same binary name; the Windows executable is rebuilt from the library
(BEHAVIOUR for the e2e gate: the Windows e2e must run).
Gates run: Windows clippy --all-targets -D warnings PASS; KDE check; macOS fake-CC check of -p komorebi
-p komorebi-macos PASS (type check only); KDE cargo test -p komorebi -p komorebi-linux -p komorebic -p
komorebi-client -p komorebi-hotkeys -p komorebi-core: 903 passed, 0 failed (the four moved tests and the
unit test of daemon.rs included); CLI docs oracle identical x3; bar schema harness identical both bars;
kde-closure-check ok; nix evaluation of the root and both nested flakes PASS; by evaluation an edit of
komorebi/src/daemon.rs changes the Windows derivations only, of the KDE daemon.rs kfde only, of the macOS
one neither (the shared komorebi-daemon/src/main.rs changes all, as expected). Not run: nix builds, VM,
e2e, any Mac run.
New extras scenario e2e/platforms/qemu_windows/extras/bar.py, registered in
run.py as `bar` (runs after the tiling windows, like the other Windows
extras). It starts komorebi-bar in the guest with a configuration that has
storage, time, applications, komorebi workspaces and layout widgets, the
Windows-only Keyboard and Systray widgets and a `mouse` block (a message and
a command), and checks: `komorebi-bar --schema` equals the checked-in
schema.bar.json byte for byte; the process starts and its window titled
komorebi-bar appears, visible and sized; it runs 15 s (scaled); `komorebic
state` answers and komorebi does not tile the bar; commands that notify the
bar work; the bar survives `komorebic stop` and the daemon starting again as
the same process (it reconnects: it does NOT exit when the daemon stops, so
the task text "exits cleanly when komorebi stops" is checked as
`komorebic stop --bar` ending daemon and bar); screenshots are kept as
artefacts, no pixel assertions. No known failures.
Plumbing: run.py uploads komorebi-bar.exe when the binaries directory has it
(other scenarios do not need it, so older build-ref directories still work),
the nix app copies it and sets KOMOREBI_E2E_BAR_SCHEMA to the checked-in
schema (the e2e directory alone does not contain it), build-ref.sh builds it.
README and docs/dev/bar-e2e.md document it.
Verified: py_compile and ruff clean; the runner and library unit tests: 157
passed; flake.nix parses. NOT run: the scenario itself (the Windows guest is
reserved for gates), so every check is untested against a real bar and may
need adjusting (window title, timings, the Systray widget inside the VM).
Needs gate: win-e2e `bar`.
Records the HideSpot change and the three macOS layers (container, workspace,
monitor) as done, lists the functions that stay in the macOS extension traits,
and notes that ContainerExt is the old container code kept for the daemon's own
call sites.
Verified: documentation only.
Section 9 of docs/dev/settings.md: what S3 moved, how apply_globals and the
command write it, how readers get it, and that the only BEHAVIOUR is the
single publish.
Verified: not applicable (documentation).