mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-16 13:51:19 +01:00
Step 11(iii), the Workspace layer. BEHAVIOUR (type-checked and clippy-clean with the fake CC; the macOS tests are the oracle and have not run). pub type Workspace = komorebi_core::Workspace<MacosPlatform>. About 53 of the 65 functions of the macOS workspace.rs are the shared ones now (identical, or differing only in the id type, the Container type or a hook; section 14 of core-model.md lists them). MacosPlatform implements WorkspacePlatform: foreground_window_id and cursor_position (the same MacosApi calls), should_act_window(_individual) (the macOS should_act with the class as a one-element slice), the three scrolling hooks, after_floating_removed (focus_previous_floating_window, which is shared), and the two hide spots: hide_spot is the monitor's corner with no display (what every Window::hide call had), hide_spot_on_display adds the display bounds from the work area (what Workspace::hide gave the containers). The corner is MacosWorkspaceState, which the monitor sets next to the globals (it was a field of the macOS WorkspaceGlobals, which is now the shared type; both are serde-skipped, so the JSON is the same). The eight functions that took the hiding position (hide, move_window_to_container, new_floating_window, new_container_for_focused_window, new_container_for_window, reintegrate_monocle_container, new_monocle_container, focus_container_by_window) are the shared ones with the spot argument; the ones that stay macOS's are WorkspaceExt (update, apply_wallpaper, restore, remove_window, load_static_config, prune_duplicate_windows, visible_window_details, reap_invalid_windows_for_application, restore_windows, calculate_layouts, set_scrolling_columns) and, in scrolling.rs, the former inherent methods now the trait WorkspaceScrolling (an inherent impl on a type of another crate is not allowed). The Window implements WorkspaceWindow (class is its role, path a String). From<&Workspace> for WorkspaceConfig, an orphan impl now, is the function workspace_config. The shared Workspace has one field macOS lacked (initial_window_placement_rules, None and skipped when None), so the JSON has the same keys: new test state_pin pins them. Behaviour that is deliberately kept: floating windows are hidden at the corner with no display (hide_spot), containers with the display; ContainerWindow's hide and restore skip their work under cfg!(test), as the old container code did. No silent bind: the names of the methods of WorkspaceExt, WorkspaceScrolling and ContainerExt share no name with a method of the shared Workspace (checked mechanically: the intersection with the core inherent names is only Container::restore, a different type); and each of the shared functions that used to take the corner has a different signature from the macOS one it replaced, so a stale call is a compile error, which was the order in which the errors showed up. Verified: fake-CC cargo clippy --locked --target aarch64-apple-darwin -p komorebi-macos --all-targets -D warnings clean; tools/fast-check macOS PASS. Not verified: any macOS test or run. Verified on the Mini: not yet. Gate: the Mini's cargo test, then the hand check added to docs/dev/macos-handcheck.md.