Commit Graph
20 Commits
Author SHA1 Message Date
LGUG2Z 658827fcd5 fix(lint): build errors with Report::msg, not the eyre! macro the workspace bans
The ban (`just lint`, and now the hygiene job) came from the macOS and KDE repositories and was
never applied to the Windows code, so the unified tree had sixteen uses of the macro: seven in
the Windows daemon, six in komorebi-core (written during the unification), one in the KDE
backend and two in the recorder. Each becomes eyre::Report::msg, with format! where the message
has arguments.
2026-11-05 16:13:37 -08:00
LGUG2Z f4b4d0ff05 feat(core): the window, named-workspace and behaviour-toggle commands as shared functions
Adds to komorebi_core::command: move_window, focus_window,
cycle_focus_window (layer dispatch: tiling or floating function of the
host), preselect_direction, cancel_preselect, promote_window,
monitor_workspace_index_by_name, focus_named_workspace,
move_container_to_named_workspace(follow), and the three behaviour toggles
(toggle_window_container_behaviour, toggle_cross_monitor_move_behaviour,
toggle_monocle_focus_behaviour). The host traits are WindowCommandHost
(thin forwards to each daemon's direction functions plus
update_focused_workspace_layout) and BehaviourCommandHost (get and set of
three settings). The bodies are the text the router arms have on all three
daemons today. Nothing calls them yet: the daemons converge in the next
three revisions. No behaviour change.

Native tests on the recording stub host, each naming its commands.py
check (mirrors: commands / ...): 5 new tests, komorebi-core commands
test file 23 passed (was 18).
Verified: cargo test -p komorebi-core --features schemars all pass;
clippy -D warnings on komorebi-core all targets passes; format-all
--check clean.
2026-11-05 15:03:27 -08:00
LGUG2Z e70a0e4921 style(windows): format with the project's rustfmt settings (tools/format-all --apply --tree windows)
Pure formatting by the same nightly rustfmt invocation the nix fmt check uses (tools/format-all, edition 2024, the tree's rustfmt.toml). No code change. Applied last on the candidate because it touches many files other agents were editing. Verified: tools/format-all --check --tree windows passes afterwards; light gates (fast-check) after all three.
2026-11-05 15:03:27 -08:00
LGUG2Z 3e5475e7ef refactor(core,kde,windows,mac): remove CommandHost::POINTER_PICKS_THE_MONITOR_FOR_ALL
All three daemons now let the pointer pick the monitor for every shared
command that has the preamble, so the const has no reason left. The
shared functions always call focus_the_monitor_under_the_pointer; the
three CommandHost impls lose the const (Windows had it true already, so
nothing changes there). The core test of the switch becomes
the_pointer_picks_the_monitor_..._on_all_platforms. known-issues item 1
is marked resolved and core-model.md section 18 text is updated.

No behaviour change in this revision beyond the previous two.
Verified: komorebi-core tests all pass (command tests 18); KDE cargo test
-p komorebi-linux 670 passed, 0 failed; fake-CC clippy for the four macOS
packages passes; cargo clippy -p komorebi-windows --all-targets -D warnings
passes. Not verified: Windows tests or e2e (cannot run on Linux).
2026-11-05 15:03:26 -08:00
LGUG2Z 4c15358f7b refactor(core,kde,windows,mac): FocusWorkspaceNumber and FocusWorkspaceNumbers are komorebi-core commands
komorebi_core::command gets focus_workspace_number (show a workspace unless
it is in front) and focus_workspace_numbers (show it on every other monitor,
then on the focused one), both with the pointer preamble when the host's
POINTER_PICKS_THE_MONITOR_FOR_ALL says so, over a new CommandHost method
show_workspace_on (focus the workspace of a monitor and load it, which the
daemons already did inline). The three daemons' arms call them (Windows keeps
its focus_workspace_numbers method as a wrapper) and implement
show_workspace_on. The const is unchanged: true for Windows, false for KDE and
macOS, so nothing changes yet; the next revisions flip it. Tests: the
Windows-switch test becomes a test of all five commands with the switch off and
on, and focus_workspace_number(s) are tested on the stub host (commands.py:
focus-workspace, focus-workspaces).

Verified: cargo test -p komorebi-core --features schemars --test commands: 18
passed; KDE cargo test -p komorebi-linux (lite env): 666 passed, 0 failed; fake-CC cargo
clippy -D warnings on the macOS packages: PASS; Windows cargo clippy -p
komorebi-windows --locked --all-targets -D warnings: PASS. Not run: Windows
tests, VM and Mac.
2026-11-05 15:03:26 -08:00
LGUG2Z 176dc0a8ba test(core): make the command tests clean under clippy -D warnings
komorebi-core is in the workspace default-members since the review fixes, so a bare clippy --all-targets -D warnings now covers its test files. crates/komorebi-core/tests/commands.rs (wip-u-cmd) had two findings that only show there: an unused Result of new_container_for_window (now unwrap()ed: the stub window cannot fail) and a never-read field pointer_for_all (removed: the Windows switch is tested through the associated const in its own host type). No behaviour change; verified: cargo test -p komorebi-core and the Windows clippy (bare, default-members).
2026-11-05 15:03:26 -08:00
LGUG2Z 0bf26a6d14 feat(core): lock and unlock a container by index, with native tests
komorebi_core::set_container_locked is the body of the
LockMonitorWorkspaceContainer and UnlockMonitorWorkspaceContainer arms
(the two differ by the flag; the text is the same on all three daemons),
over a third small host trait ContainerCommandHost: CommandHost that has
monitors_mut. Tests: lock then unlock, a container index that is not there
is ignored and a missing monitor or workspace is an error.

Verified: cargo test -p komorebi-core --features schemars --test commands
(native): 16 passed, 0 failed. Not run: the daemons.
2026-11-05 15:03:26 -08:00
LGUG2Z 6e38ddc1f8 feat(core): the commands that move across workspaces and monitors, with native tests
Eight arms' worth of the router as functions of komorebi_core::command:
cycle_move_container_to_workspace (the move and the send arm, by follow),
cycle_focus_monitor, cycle_move_container_to_monitor (move and send),
focus_monitor_workspace_number and move_container_to_monitor_workspace_number
(move and send). They need five more operations of the window manager, in
a second trait MonitorCommandHost: CommandHost (mouse_follows_focus,
update_focused_workspace, direction_from_monitor_idx,
move_container_to_monitor, focused_workspace_idx), so the daemons that
implement only the first trait still compile. The text is the KDE text,
which Windows and macOS have byte for byte. tests/commands.rs mirrors the
e2e checks of commands.py: cycle-move-to-workspace and cycle-send-to-workspace,
cycle-monitor (the wrap), cycle-move-to-monitor and cycle-send-to-monitor,
focus-monitor-workspace, move-to-monitor-workspace and
send-to-monitor-workspace.

Verified: cargo test -p komorebi-core --features schemars (native): the
commands test file 14 passed, 0 failed (the rest of the crate unchanged).
Not run: the daemons (nothing calls the functions yet).
2026-11-05 15:03:26 -08:00
LGUG2Z 7b3f691194 feat(core): the first shared commands, over a CommandHost, with native tests
komorebi-core gets `command`: the workspace navigation commands as
functions generic over a CommandHost (the few window-manager operations
they build on: the monitors and the focused one, the monitor under the
pointer, focus_monitor, focus_workspace, move_container_to_workspace):
cycle_focus_workspace, cycle_focus_empty_workspace, close_workspace,
focus_last_workspace and move_container_to_last_workspace. The text is
KDE's (which is macOS's); the one platform difference, that Windows lets the
pointer pick the monitor first for cycle_focus_empty_workspace,
close_workspace and focus_last_workspace where KDE and macOS do not, is the
associated const CommandHost::POINTER_PICKS_THE_MONITOR_FOR_ALL (false by
default). Nothing uses them yet.

tests/commands.rs implements the host with a recording stub and mirrors the
e2e checks of commands.py (cycle-workspace, cycle-empty-workspace,
close-workspace, focus-last-workspace, move-to-last-workspace and
send-to-last-workspace): wrap-around, the pointer's monitor, which
workspaces close, going back and forth, follow and send, and the Windows
switch.

Verified: cargo test -p komorebi-core --features schemars (native): 30
unit + 9 command tests passed, 0 failed (and the other test files of the
crate). Not run: the daemons (nothing calls the functions yet).
2026-11-05 15:03:26 -08:00
LGUG2Z 97c21b9360 merge: wip-cand6
Merge of wip-cand5, wip-u-bugfix, wip-u-wm, wip-u-settings3, wip-u-repotools,
wip-u-nix3 and wip-u-e2e2unit.

Resolutions:
- docs/dev/macos-handcheck.md: every section is kept, in order. The bugfix
  agent's section F (bar clicks) and the settings agent's section (also
  headed F) both appended after E; the settings one is renamed G, text
  unchanged.
- komorebi-for-mac/komorebi/src/animation/mod.rs and static_config.rs: the
  formatting-only revision of wip-u-nix3 (76ab52da, import order) conflicts
  with the semantic edits of wip-u-settings3 (S4/S5). The files are taken
  from wip-u-settings3 as they are; the following style(macos) revision
  formats them again with the check's rustfmt invocation.

Verified: see the following revisions and the report.
2026-11-05 15:03:26 -08:00
LGUG2Z acbe816fb4 test(core): follow the rename of the floating-window hook to before_floating_removed
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).
2026-11-05 15:03:26 -08:00
LGUG2Z 231e50b3fc test(core): tiling arithmetic of update_shared as native checks of the e2e layouts
The Windows e2e scenarios layouts (111 checks), flipping, layout_flip, padding,
closing, minimizing, floating, stacks, tiling and tiling_off assert where the
tiles of a workspace are. Since the consolidation every daemon gets those tiles
from komorebi-core's Workspace::update_shared, so they can be checked on the
stub platform on Linux (and on the Mac Mini for macOS) instead of in a guest.

crates/komorebi-core/tests/e2e_layouts.rs (6 tests) runs update_shared on a
StubPlatform workspace for the 8 layouts of the scenario, 1 to 8 containers and
three padding settings: one tile per container, inside the work area, not on
each other; workspace padding moves tiles 40 px in, container padding shrinks
every tile, and back as it was; each of the three flips equals the plain tiles
mirrored (as a set); removing a container (what a closed, minimized or floated
window does) leaves the others at least as much room; two containers, one a
stack of two, are two tiles; with tiling off nothing is placed in any layout.
Each test names the e2e checks it mirrors. They protect Windows, KDE and macOS
alike. Platform dependent: the stub adds no border and no frame adjustment, so
the Windows border of 7 px (windows_padding) and each daemon's own
adjust_layout stay e2e only, as does the OS frame matching the tile.

Verified: cargo test -p komorebi-core --test e2e_layouts, 6 passed (native
Linux; macOS crates run later on the Mini). No source change, no bug found.
2026-11-05 15:03:26 -08:00
LGUG2Z fa3ec1ba2e test(core): add the review's gaps: floating hook order, placement rules, hook defaults, key sets
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.
2026-11-05 15:03:26 -08:00
LGUG2Z 38f1295251 test(core): pin the state JSON of the three daemons from real fixtures
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.
2026-11-05 15:03:26 -08:00
LGUG2Z f74e201f64 test(core): pin Monitor workspace management
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.
2026-11-05 15:03:26 -08:00
LGUG2Z 3cc8ff63b3 fix(core): constrain the main container of the right-main vertical stack at index 0
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.
2026-11-05 15:03:26 -08:00
LGUG2Z a1a18a7afc test(core): pin the hook order and arguments of Workspace::update_shared
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.
2026-11-05 15:03:26 -08:00
LGUG2Z 8d881bc229 test(core): pin monocle, floating, layer and hide behaviour, and the resize constraints
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.
2026-11-05 15:03:26 -08:00
LGUG2Z 92943f7cba test(core): pin Workspace container ring, placement, stacking and promote
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.
2026-11-05 15:03:26 -08:00
LGUG2Z d20432f087 test(core): add a recording stub platform and pin Container behaviour
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.
2026-11-05 15:03:26 -08:00