mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-18 22:58:34 +01:00
komorebi-core gets Workspace<P: WorkspacePlatform>, moved from komorebi-for-kde/komorebi/src/workspace.rs (KDE is the base), together with WorkspaceLayer, WorkspaceWindowLocation, CachedLayoutDefault and the two threshold helpers, and these 52 functions of its impl, whose text is the same on both daemons (add_container_to_back/front, the container focus and removal family, insert_container_at_idx, swap_containers, preselect and monocle operations, new_container_for_window and resolve_placement_index, location_from_exe, visible_windows, the enforce_resize_* family, the window lookups, remove_floating_window and the floating focus helpers, is_scrolling). They are generic over P::Window (Container<P::Window>, PlatformWindowId<P>), and every private function is pub so the daemons' own methods can call it. The accessors the impl_ring_elements! macro made are written out. WorkspacePlatform is the hook trait: Window (a WorkspaceWindow), State (what only a platform keeps in a workspace; skipped in the JSON and the schema), default_padding, foreground_window_id, cursor_position, should_act_window and should_act_window_individual (the platform holds the compiled regexes), the three scrolling lookups and after_floating_removed (KDE refocuses a floating window). Default for Workspace<P> is the KDE one with the padding from the hook. serde and schemars bounds are on P::Window; the schema is named Workspace. Not used by any daemon yet; the next revisions make each daemon use it. Four tests with a stub platform cover new_container_for_window, the focus, the JSON keys and the default. Verified: cargo test -p komorebi-core --features schemars (native): 20 passed, 0 failed; Windows clippy --workspace --locked --all-targets -D warnings: PASS (compiles the crate). Not run: the daemons.