docs: record Monitor<P> and the four hook-shared workspace functions

docs/dev/core-model.md section 13: what Monitor<P> holds and what stays in
MonitorExt, why the two globals updates are not shared (KDE's plural one
has no border), the serde facts the tests pin (flattened map keys, the
schema order) and the hooks of promote_container, effective_layout_options,
new_floating_window and hide.

Verified: not applicable (documentation).
This commit is contained in:
LGUG2Z committed 2026-10-31 13:19:31 -07:00
1 parent c4586a9f73
commit 6ad0554556
1 file changed
+24
+24
View File
@@ -975,3 +975,27 @@ Constraints that make this safe to implement, all checked against the diff:
// Always make sure that the length of the resize dimensions vec is the same as the
```
## 13. Monitor<P> and the three hook-shared functions (landed)
`komorebi-core` has `Monitor<P: MonitorPlatform>`: `MonitorPlatform` extends `WorkspacePlatform` with
`Id`, `SerialNumber` (`Default`, so a missing `serial_number_id` reads as the platform's default),
`Extra` (flattened into the JSON; `NoExtra` on KDE, `WindowsMonitorExtra` {name, device_id,
workspace_names} on Windows), `serialize_id`/`deserialize_id` (each daemon keeps writing its id as the
plain number it always did), and `known_workspace_name`. Eight functions are shared
(`focused_workspace_layout`, `focused_workspace_name`, `new_workspace_idx`, `ensure_workspace_count`,
`remove_workspaces`, `remove_workspace_by_idx`, `add_container`, `focus_workspace`); the rest of the old
impl (the constructors, `load_focused_workspace`, the globals updates, `update_focused_workspace`,
`move_container_to_workspace`, `add_container_with_direction`, `assign_windows_to_workspaces`) is the
daemons' `MonitorExt`. The two globals updates are NOT shared: KDE's `update_workspaces_globals`
hard-codes no border while its `update_workspace_globals` honours `BORDER_DRAWN`, so one hook
would change KDE.
Facts the tests pin: the JSON of a monitor with flat extra fields and the id as a number; a flattened
map reads its keys as strings, so integer-keyed extra fields need a `deserialize_with`; the schemars
`required` order of the runtime schema has the flattened fields last (D-coord-4, accepted).
`promote_container`, `effective_layout_options`, `new_floating_window` and `hide` are shared too, with
the hooks `primary_container_idx` (Windows custom layouts), `unmaximize_window` (KDE) and
`before_hide_containers` (the KDE scrolling prelude). `effective_layout_options` needed no hook: its
Windows `Custom` arm is the crate's fallback arm, unreachable on KDE.