mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-16 22:01:22 +01:00
refactor(mac): the daemon uses the shared Container API with the hide spot
Deep dedup D-coord-13 (1), the container API. BEHAVIOUR (type-checked and clippy-clean with the fake CC; the macOS tests are the oracle). ContainerExt is deleted. Its four methods were the shared Container's with the monitor's corner as an argument; every call (about 28 sites in window_manager.rs, process_event.rs, scrolling.rs, workspace.rs, monitor.rs) is now the shared one: add_window(window, spot), load_focused_window(spot), hide(omit, spot), restore(), with spot = workspace.hide_spot() (MacosPlatform::hide_spot: the workspace's corner, no display, which is what the old calls passed; hide_on's screen argument was None at every remaining caller; the whole-workspace hide with the display is Workspace::hide, already shared). The nine window manager functions that differed from KDE's only in these calls (add_window_to_container, cycle_container_window_in_direction, cycle_container_window_index_in_direction, focus_container_window, stack_all, monocle_on, monocle_off, cycle_monocle, transfer_window) now differ from KDE's text only in the spot and in the error policy (let _ against ?), which the next revisions remove. Two things change at run time, both small: monocle_on and cycle_monocle took the corner from the monitor (monitor.extra.window_hiding_position) and now take it from the workspace's state, which the monitor writes into every workspace when it updates their globals, so they differ only if a workspace's globals are stale (a config reload without a layout update in between); and Container::restore skips the Accessibility call under cfg!(test), as hide and load_focused_window already did. Verified: fast-check macOS PASS; fake-CC cargo clippy -p komorebi-macos --all-targets -D warnings clean. Not verified: any macOS test or run. Verified on the Mini: not yet. Hand check row added to docs/dev/macos-handcheck.md.
This commit is contained in:
1 parent
401ce9112a
commit
a478495049
7 files changed
+46
-177
No files matched your search
@@ -97,6 +97,7 @@ timeout. Until then H5 documents the hang.
|
||||
| 11(iii) Workspace: `refactor(mac): the daemon's Workspace is komorebi_core::Workspace<MacosPlatform>` (see `jj log -r wip-u-kfm2`) | About 50 workspace functions (container and focus operations, placement, resize constraints, window lookups, floating helpers, the stack and monocle operations that hide windows) are now the shared ones; `hide`, `new_container_for_window` and the stack functions pass the monitor's corner through `MacosPlatform::hide_spot` (kept in `MacosWorkspaceState`, set by the monitor with the globals), and `hide` passes the display bounds for the containers through `hide_spot_on_display`. macOS's own `update`, `apply_wallpaper`, `restore`, `remove_window`, `load_static_config`, `prune_duplicate_windows`, `visible_window_details`, `reap_invalid_windows_for_application`, `restore_windows`, `calculate_layouts` and `set_scrolling_columns` are `WorkspaceExt`; the scrolling methods are `WorkspaceScrolling`. | `cargo test` first (the workspace, scrolling and window_manager tests). Then: stack and unstack, switch workspaces both ways (each stack shows its front window, the hidden ones are in their monitor's corner), toggle monocle and back, float and unfloat a window, cycle the monocle container, move a window to another workspace, move a container across monitors; with a different `window_hiding_position` on each monitor check each monitor's windows park in their own corner and that a floating window that overhangs the edge of a display is still parked on its own display. `komorebic state` keys of a workspace are unchanged (pinned by `state_pin`). Scrolling layout: focus, move, consume and expel, pan, resize a column. |
|
||||
| 11(iii) Monitor: `refactor(mac): the daemon's Monitor is komorebi_core::Monitor<MacosPlatform>` (see `jj log -r wip-u-kfm2`) | The monitor is the shared generic type; the corner (`window_hiding_position`) is the platform's flattened `extra` (written last, as before), the constructors, `update_*_globals`, `load_focused_workspace`, `move_container_to_workspace(1)`, `add_container_with_direction`, `hide_unfocused_workspaces` and `restore_focused_workspace` are `MonitorExt`; `focus_workspace`, `add_container`, `remove_workspace*`, `ensure_workspace_count` and the name and layout lookups are the shared ones. The monitor gives its workspaces the corner through `workspace.state` when it updates their globals. | `cargo test` (monitor tests, `state_pin`). By hand: `komorebic state | jq '.monitors.elements[0] | keys_unsorted'` is the same list as before with `window_hiding_position` last; switch workspaces on each monitor (hide and restore of the whole workspace), focus-workspace by index and by name, move a container to another workspace and to another monitor, unplug and replug a display (the monitor and its workspaces are rebuilt through `Monitor::new` and `update_all_workspace_globals`), a config with `window_hiding_position` per monitor. |
|
||||
| `wip-u-kfm3` registry fixes (see `jj log -r wip-u-kfm3`) | The registry keeps inert application copies (no blocking Accessibility call when an entry is dropped), a window is registered when its observer is attached, a clone being dropped no longer deregisters its window, `forget_pid` runs ahead of the pause and other-space returns, and the application reaper forgets what it reaps. Nothing reads the registry except the unused `MacosBackend`. | H3, H4, H6, H7 above, and the usual walk-through: no change in what the daemon does is expected. |
|
||||
| deep dedup 1: `refactor(mac): the daemon uses the shared Container API with the hide spot` (see `jj log -r wip-u-mac-deep`) | `ContainerExt` (`add_window_at`, `load_focused_window_at`, `hide_on`, `restore_focused_window`) is gone: every call is the shared `Container::{add_window, load_focused_window, hide, restore}` with `workspace.hide_spot()`. `monocle_on` and `cycle_monocle` took the corner from the monitor (`monitor.extra`) and now take it from the workspace (`workspace.state`), which the monitor writes with the globals; `restore()` now skips the Accessibility call under `cfg!(test)`. | `cargo test`; then H1 (hide spot) and: toggle monocle on a workspace with two containers on a monitor with `window_hiding_position: BottomRight` (every other container parks in that corner), cycle the monocle container, stack with `komorebic stack`/`stack-all`, `cycle-stack`, `add-window-to-container`, switch workspaces. Change the monitor's `window_hiding_position` in the config, reload, and toggle monocle at once: the corner must be the new one. |
|
||||
|
||||
Revisions in section B change no behaviour on purpose (rename, move, route); they still need the sections C walk-through, because a mechanical mistake would show there.
|
||||
|
||||
|
||||
Reference in new issue
Block a user