mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-27 19:02:47 +01:00
chore(repo): combine candidate 6 with the shared rule matcher, the stall fixes, the bar scenario fix and the shared commands (candidate 7)
Candidate 7: wip-cand6 plus wip-u-rulematch (one window-rule matcher in komorebi-config), wip-u-stall2 (lock-holder guard, should_manage before the lock, reaper unlock, heartbeat), wip-u-bar3 (bar e2e scenario fix, skip when the guest cannot draw, bar config tests) and wip-u-cmd (komorebi_core::command: 16 shared router arms). Conflicts, if any, are resolved here.
This commit is contained in:
commit
e870eca239
37 files changed
+2940
-2120
No files matched your search
@@ -24,3 +24,52 @@ macOS (see `docs/dev/macos-handcheck.md`).
|
||||
|
||||
Not run when it was written (the guest was reserved): lint only (`py_compile`, `ruff`, the runner's
|
||||
157 unit tests pass).
|
||||
|
||||
## The golden guest has no OpenGL 2.0
|
||||
|
||||
The Windows gate (candidate 5) found that the bar cannot open a window in the golden guest:
|
||||
eframe's default renderer is `egui_glow`, the guest has the basic display adapter and QXL and no
|
||||
OpenGL driver, so Windows offers only the generic software OpenGL 1.1 of `opengl32.dll`, and the bar
|
||||
exits at start with `Error: egui_glow: OpenGL: egui_glow requires opengl 2.0+`
|
||||
(`komorebi-bar/src/windows/mod.rs`, the `run_native` error). The scenario therefore reports the
|
||||
window, stays-alive and daemon-restart checks as `skipped: guest has no OpenGL 2.0` when, and only
|
||||
when, the bar's own output says that (`extras/bar.py`, `classify`); any other early exit is a
|
||||
failure. The schema equality, the configuration read, `komorebic state` and `stop --bar` stay real
|
||||
checks. A skip is not a pass: the bar's runtime behaviour is unverified until the guest can draw.
|
||||
|
||||
### Getting rendering into the guest (analysis, nothing added)
|
||||
|
||||
How the context is chosen: `komorebi-bar` uses `eframe` 0.33 with its default features, so only
|
||||
the glow renderer is compiled (glutin + `egui_glow`); `NativeOptions` is left at its defaults on
|
||||
Windows (the macOS bar sets its own), so the bar asks for a hardware OpenGL 2.0+ config through
|
||||
glutin, falls back to the Windows generic GDI implementation (1.1) and `egui_glow` refuses it.
|
||||
|
||||
1. Mesa llvmpipe `opengl32.dll` next to `komorebi-bar.exe` (the classic recipe: Mesa's
|
||||
`opengl32.dll` takes over from the system one for that process). Not possible from this flake:
|
||||
nixpkgs marks `pkgsCross.mingwW64.mesa` as an unsupported platform (`nix build --dry-run` refuses
|
||||
it), and `nixpkgs` has no Windows `opengl32sw.dll` (that file ships with Qt) or ANGLE. Building
|
||||
Mesa for mingw means porting its nix expression (swrast + llvm cross for mingw, a cross LLVM
|
||||
build) and carrying a binary of unknown license status in the image: days of work, hours of
|
||||
build, and the result is a third-party DLL in the test that real users do not run.
|
||||
2. A wgpu renderer with the Windows software adapter. Windows 11 ships WARP, the software
|
||||
Direct3D 12 rasteriser, in the Basic Render Driver, which the guest has; wgpu's DX12 backend
|
||||
finds it as an adapter, no download. In `eframe` this is the `wgpu` feature plus
|
||||
`NativeOptions { renderer: Renderer::Wgpu, .. }` (and `wgpu_options` with a fallback adapter if
|
||||
it does not pick WARP by itself). The sources of the wgpu stack (wgpu 27, naga, wgpu-hal,
|
||||
gpu-allocator, ash) are already in the local cargo registry because they are in `Cargo.lock`
|
||||
as optional dependencies of eframe, so it should build offline. Proposal, smallest first:
|
||||
in `komorebi-bar`'s `[target.'cfg(windows)'.dependencies]` ask for `eframe` with the `wgpu`
|
||||
feature, and at start: try glow as now; if `run_native` fails with the OpenGL message, run again
|
||||
with `Renderer::Wgpu` (the e2e then passes the window checks, and a user without OpenGL gets a
|
||||
bar instead of an error). Cost: about 60 more crates in `Cargo.lock` that are compiled for
|
||||
Windows only (cold build +3 to 5 minutes in CI, +8 to 12 MB in `komorebi-bar.exe`); a retry path
|
||||
that needs `NativeOptions` to be built twice; a new, untested code path for real users (low
|
||||
risk: it only runs where glow already failed). Without the fallback, a `KOMOREBI_BAR_RENDERER=wgpu`
|
||||
switch the scenario sets would keep users on glow and cost the same dependencies.
|
||||
3. ANGLE (EGL on Direct3D 11, itself on WARP) through `glutin`'s EGL support: needs
|
||||
`libEGL.dll`/`libGLESv2.dll`, which are not in nix either. Rejected.
|
||||
|
||||
Recommendation: 2, with the glow-then-wgpu fallback, as its own revision with the e2e `bar`
|
||||
scenario as its gate (the window checks stop being skipped). Whether the guest's WARP accepts
|
||||
wgpu's DX12 device (feature level, no HLSL compiler problem for egui's shaders) can only be
|
||||
learned by running it; the first run should keep `RUST_LOG=wgpu_hal=debug` output in `bar.out`.
|
||||
@@ -1371,3 +1371,41 @@ Recommended next step: kfm unifies the container API (blocker 1) and the `?` pol
|
||||
daemons; after that the nine functions are identical and the shared share passes 60% without new
|
||||
hooks, and `WindowManager<P>` can be created over KDE and macOS with the entry points of blocker 3 left
|
||||
in each daemon's extension trait.
|
||||
|
||||
## 21. The shared commands (`komorebi_core::command`, wip-u-cmd)
|
||||
|
||||
**Mechanism.** The daemons' `WindowManager` is per platform, so the commands cannot be methods of a
|
||||
shared type yet; they are free functions generic over a *host*, a small trait the daemon implements by
|
||||
forwarding to its own methods: `CommandHost` (monitors, focused monitor, the monitor under the pointer,
|
||||
`focus_monitor`, `focus_workspace`, `move_container_to_workspace`), `MonitorCommandHost` (mouse follows
|
||||
focus, `update_focused_workspace`, `direction_from_monitor_idx`, `move_container_to_monitor`, the focused
|
||||
workspace index) and `ContainerCommandHost` (`monitors_mut`). A recording stub host in
|
||||
`crates/komorebi-core/tests/commands.rs` tests each function natively, naming the e2e check of
|
||||
`commands.py` it mirrors; this is the model-level command harness that only KDE had.
|
||||
|
||||
**Moved (sixteen router arms, the same text on all three daemons):** the workspace navigation
|
||||
(`CycleFocusWorkspace`, `CycleFocusEmptyWorkspace`, `CloseWorkspace`, `FocusLastWorkspace`,
|
||||
`MoveContainerToLastWorkspace`, `SendContainerToLastWorkspace`), the moves across workspaces and
|
||||
monitors (`CycleMoveContainerToWorkspace`, `CycleSendContainerToWorkspace`, `CycleFocusMonitor`,
|
||||
`CycleMoveContainerToMonitor`, `CycleSendContainerToMonitor`, `FocusMonitorWorkspaceNumber`,
|
||||
`MoveContainerToMonitorWorkspaceNumber`, `SendContainerToMonitorWorkspaceNumber`) and the lock and
|
||||
unlock of a container by index. The one platform difference found, that Windows lets the pointer pick the
|
||||
monitor first for the empty, close and last-workspace commands (a probable omission on KDE and macOS,
|
||||
section 18), is the const `CommandHost::POINTER_PICKS_THE_MONITOR_FOR_ALL`, true only for Windows.
|
||||
|
||||
**What stays, and why** (identical across the three unless noted; each needs a `WindowManager` method
|
||||
or field, so moving them means moving `WindowManager`, the blockers of section 18):
|
||||
- the moves and focus by direction (`MoveWindow`, `FocusWindow`, `CycleFocusWindow`, `CycleMoveWindow`,
|
||||
`PreselectDirection`, `Promote*`, `StackWindow`, `UnstackWindow`, `StackAll`, `CycleStack*`): they call
|
||||
`move_container_in_direction`, `focus_container_in_direction` and the floating variants, which are the
|
||||
big window manager functions with the platform window operations;
|
||||
- the named-workspace commands (`MoveContainerToNamedWorkspace`, `SendContainerToNamedWorkspace`,
|
||||
`FocusNamedWorkspace`, the layout and tiling by name): need `monitor_workspace_index_by_name`, a
|
||||
`WindowManager` method over the monitors (a candidate for the next host method once the names are
|
||||
in `Monitor`);
|
||||
- the behaviour toggles (`ToggleCrossMonitorMoveBehaviour`, `ToggleWindowContainerBehaviour`): fields
|
||||
of `WindowManager`;
|
||||
- the layout and rule commands (`WorkspaceLayout*`, `WorkspaceRule`, `ContainerPadding`,
|
||||
`WorkAreaOffset`, ...): thin calls of `WindowManager` methods that edit a workspace and re-layout, the
|
||||
same coupling;
|
||||
- queries, configuration, borders, animations, transparency, schema: statics and the platform.
|
||||
@@ -45,7 +45,7 @@ times (Windows `komorebi/src/window.rs:1178`, KDE `window.rs:661`, macOS `window
|
||||
| workspaces (8), workspace_moves (8) | send/move/focus workspace, last-workspace | A: `monitor_workspaces.rs` (focus, last focused, ensure, remove); the OS hide/show is C | - | - | med |
|
||||
| commands (265, 7.6 min) | every komorebic command leaves the daemon alive, answers state, manages every window | A now for command line (`crates/komorebic-core/tests/e2e_sweep.rs`: every SWEEP/PRINTED line is a Windows command; macOS lacks exactly 8) and for the KDE model (`komorebi-for-kde/komorebi/tests/command_sweep.rs`, about 185 messages, 0.2 s); B: same sweep for the Windows and macOS daemons (needs seam, below); C: stall-family (daemon busy 8 s), socket answering | S done / L for Win+mac | highest: biggest, flakiest scenario |
|
||||
| unknown_monitor (12) | a window sent to a monitor that does not exist stays managed | B: shared `Monitor`/`Workspace::add_container` errors are covered (`monitor_workspaces.rs` `adding_a_container_to_a_workspace_that_is_not_there_is_an_error`); the daemon handler is per platform: needs seam | M | med (known flaky marker) |
|
||||
| rules (12), rules_class (5), rules_exe (5), manage_rules (4), title_rule (5), startup_rules (5) | which window a rule catches (kind, strategy, composite, last wins, manage over ignore); the workspace it goes to | A now for matching, KDE copy only: `komorebi-for-kde/komorebi/tests/rule_matching.rs` (13 tests). Windows and macOS copies of `should_act_individual` untested natively (windows crate does not build on Linux; macOS needs the Mini). Workspace of a rule: A in core: `workspace_containers.rs` `initial_placement_rules_choose_where_a_new_window_goes`. When-evaluated (open vs rename), hide/show: C | M to move the function into `komorebi-config` and test once for three daemons (recommended seam) | high |
|
||||
| rules (12), rules_class (5), rules_exe (5), manage_rules (4), title_rule (5), startup_rules (5) | which window a rule catches (kind, strategy, composite, last wins, manage over ignore); the workspace it goes to | A now for matching, once for all three daemons: `crates/komorebi-config/tests/rule_matching.rs` (16 tests, KDE/macOS and Windows input shapes; the matching moved to `komorebi_config::rules`, see `docs/dev/rule-matching.md`); KDE keeps the manage-rule rescue test. Workspace of a rule: A in core: `workspace_containers.rs` `initial_placement_rules_choose_where_a_new_window_goes`. When-evaluated (open vs rename), hide/show: C | M to move the function into `komorebi-config` and test once for three daemons (recommended seam) | high |
|
||||
| state_fidelity (5) | state names title/exe/class/path as opened | A: `state_roundtrip.rs` (kfw/kfde fixtures, `the_fixtures_are_the_ones_the_e2e_library_has`, `a_windows_tiled_state_is_written_as_it_was_read`); what the OS reports C | - | - | low |
|
||||
| queries (3) | `komorebic query X` answers from the state, resize save/load round trip | B: state answers per query are `StateQuery` handling in the daemon; resize round trip needs `process_command` (KDE: `resize.rs` `sizes_saved_to_a_file_are_loaded_back_from_it` A) | M | low |
|
||||
| config_reload (8) | file change reloads names, layout, rules | A for the merge/reset semantics: `crates/komorebi-settings/tests/reload.rs` (`a_reload_merges_what_the_file_gives_and_resets_what_it_resets`), `src/handle.rs`; C: the file watch and the reload message dropped while the lock is held (the NEW failing check in gate5 is that mechanism) | - | - | med |
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# Window-rule matching: the three copies and the shared one
|
||||
|
||||
`should_act` (the last rule of a list that matches a window, a composite rule needing all its
|
||||
conditions) and `should_act_individual` (one condition, by its matching strategy) existed three
|
||||
times: `komorebi/src/window.rs` (Windows), `komorebi-for-kde/komorebi/src/window.rs` and
|
||||
`komorebi-for-mac/komorebi/src/window.rs`. They are now `komorebi_config::rules`, one
|
||||
implementation that all three daemons call; each keeps its own function signatures as a thin
|
||||
wrapper so no call site changed.
|
||||
|
||||
## Classification (diff of the three copies, before the move)
|
||||
|
||||
| aspect | Windows | KDE | macOS |
|
||||
|---|---|---|---|
|
||||
| inputs | title, exe_name, `class: &str`, path | title, exe_name, `classes: &[&str]`, path | same as KDE |
|
||||
| classes | exactly one | any of the slice (`for` loop, true if any element satisfies the test) | same as KDE |
|
||||
| `.exe` in the rule id | kept: `exe_name` carries `.exe` on Windows, ids are compared as written | `identifier.id.replace(".exe", "")` before anything else (every occurrence, also in a regex id and so in the regex-cache key looked up) | same as KDE |
|
||||
| strategies (Legacy/None, Equals, DoesNotEqual, StartsWith, DoesNotStartWith, EndsWith, DoesNotEndWith, Contains, DoesNotContain, Regex) | same set, same semantics per kind | same | same |
|
||||
| Legacy/None | title and class: starts or ends with the id; exe and path: equal | same | same |
|
||||
| Regex | `regex_identifiers.get(&id)` keyed by the id, no entry means no match; applied to title, class, exe, path | same, class: any of the classes | same |
|
||||
| case folding | none (all comparisons are case sensitive) | none | none |
|
||||
| path handling | compared as given, no normalisation | same | same |
|
||||
| `should_act` | last matching rule wins, composite = all conditions | identical to Windows except the `classes` type | identical to KDE |
|
||||
| wrappers | `should_act_window(_individual)` pass the one class | same, pass `&[class]` | trait methods in `workspace.rs` call `should_act` |
|
||||
| regex cache | `REGEX_IDENTIFIERS` static in `komorebi/src/lib.rs`, filled by static config | same name, KDE lib.rs | same name, macOS lib.rs |
|
||||
|
||||
KDE and macOS are byte-identical in both functions. The Windows copy differs in exactly two
|
||||
ways, and both are preserved by a flag or a one-element slice:
|
||||
|
||||
1. one class instead of a list: `[class]` is equivalent to the single compare for every strategy
|
||||
(checked arm by arm: any-of over one element is the one test; the negated strategies too);
|
||||
2. no `.exe` stripping: `RuleQuirks::strip_exe_from_ids` (false on Windows, true on KDE and macOS).
|
||||
|
||||
No other difference exists, so no per-call-site flag is needed beyond the one platform constant.
|
||||
The regex cache stays in each daemon (`REGEX_IDENTIFIERS`, lock order unchanged); the shared
|
||||
function receives it as `&HashMap<String, Regex>` exactly as the copies did.
|
||||
Reference in new issue
Block a user