Candidate for the Windows e2e gate: the Windows Backend switches and lock order (wip-u-kfw) with the macOS registry and Window methods (wip-u-kfm). Merge of two independent stacks that both touch crates/komorebi-backend; conflicts, if any, are resolved in this revision.
The (now identical) config.rs of both bars becomes
crates/komorebi-bar-core/src/config/komobar.rs; each shell config.rs is one
line, `pub use komorebi_bar_core::config::*;`. Import edits only: statics
from crate::statics, PathExt/SocketMessage from komorebi-protocol, Rect from
komorebi-layouts, the platform hooks and WidgetConfig as in the core. The
core gains komorebi-themes (KomobarTheme, Colour; schemars forwarded): one
line in each Cargo.lock. About 590 lines per bar are gone.
Because the configuration types are now all in the core, the oracle test
regenerates the macOS schema natively: the macOS view of
`schema_for!(KomobarConfig)` is byte-identical to
komorebi-for-mac/schema.bar.json (new test `generated`). Windows is still
compared by the out-of-tree harness: three descriptions in komorebi-protocol
and komorebi-themes read differently when compiled for Windows, which a
Linux test cannot do.
Verified: native bar-core tests 3 unit + 6 oracle (incl. the generated macOS
view); schema harness macOS and Windows byte-identical (3,774 / 9,091
lines); Windows clippy -D warnings --locked clean; macOS fake-CC check
--locked 0 errors (core files touched first). Not run: the bars.
komorebi-for-mac/komorebi-bar/src/config.rs is now a byte copy of the
Windows one. What that adds on macOS: the `mouse` options (MouseConfig,
MouseMessage, KomorebiMouseMessage), which were commented out; the Windows
spelling of the documentation (10 vs 10.0, the defaults sentence, `50` for
the height default and the root description naming the Windows release),
which the macOS schema view sets back; and one warning at load: a config
that sets `mouse` is accepted and the options are ignored with a logged
warning ("not supported on this platform") on every platform but Windows.
BEHAVIOUR (macOS): a macOS config with `mouse` options used to have them
ignored silently by serde (unknown key); it still ignores them, now with a
warning. The mouse commands cannot run on macOS: exec_shell_command answers
Unsupported and nothing in the macOS bar reads `mouse`.
Verified: schema harness macOS byte-identical (3,774 lines; the view removes
`mouse`, MouseConfig and the SocketMessage closure and resets the text) and
Windows byte-identical (9,091); Windows clippy -D warnings --locked clean;
macOS fake-CC check --locked 0 errors. Not run: the bars. Mac hand check:
start the bar with a config that has a `mouse` block and see the warning.
Pure move, no behaviour change: the impl blocks and methods of
komorebi-for-kde/komorebi/src/container.rs are in the same order as
komorebi/src/container.rs (hide, restore, load_focused_window,
idx_from_exe, contains_window, idx_for_window, remove_window_by_idx,
remove_focused_window, add_window, focus_window), impl_ring_elements!
follows the struct, the derive list and Default::default use the same
spelling. This makes the remaining differences (window id type, fallible
signatures) the only lines a diff shows. See docs/dev/core-model.md.
Verified: KDE cargo test -p komorebi --lib --tests (native): 633 passed,
0 failed. Not run: doc tests, VM suites.
The mouse code in config.rs called `crate::bar::exec_powershell` and
`komorebi_client::send_batch` directly, which ties config.rs to the Windows
shell. Two new hooks, `exec_shell_command(&str)` and
`send_komorebi_batch(Vec<SocketMessage>)`, carry them: Windows os.rs calls
exactly `crate::bar::exec_powershell` and `komorebi_client::send_batch`;
macOS os.rs forwards send_batch the same way and answers
exec_shell_command with an Unsupported error (the macOS bar has no shell
session, and its mouse block was commented out), which nothing calls yet.
Windows behaviour is unchanged (same calls); config.rs of Windows now only
depends on the platform seam.
Verified: Windows clippy -D warnings --locked clean; macOS fake-CC check
--locked 0 errors (files touched first). Not run: the bars.
The widget configuration enum moves to widgets/widget.rs of the core with
all thirteen variants (Keyboard, Media and Systray are no longer cfg-gated
or commented out per tree), plus `supported()`/`unsupported()`/`enabled()`
(enabled is now false for a widget the platform cannot run) and
`warn_unsupported`, which both shells call when they read the config. The
construction of the widget from its config (`as_boxed_bar_widget`, which
needs the runtime types) becomes the extension trait `WidgetConfigExt` in
each shell widget.rs; macOS builds a no-op `Unsupported` for the three
Windows-only widgets, which `enabled()` never lets through.
BEHAVIOUR (macOS), per D-coord-1: a macOS config with a `Keyboard`, `Media`
or `Systray` widget is now accepted and skipped with a logged warning ("the
Keyboard widget is not supported on this platform and is skipped"); before
it failed to deserialize (unknown variant), so the whole bar config was
rejected. Mac hand check: such a config starts the bar and logs the
warning. The macOS schema view removes the three variants from the
schema, so komorebi-for-mac/schema.bar.json and the nix options do not
change.
Verified: schema harness macOS and Windows byte-identical (3,774 / 9,091
lines); native bar-core tests 3+5; Windows clippy -D warnings --locked
clean (re-run after touching the files: Checking komorebi-bar-core and
komorebi-bar); macOS fake-CC check --locked 0 errors. Not run: the bars.
komorebi-for-kde's Backend is now `trait Backend: komorebi_backend::Backend`
and declares only what is KDE's own: drag_origin and drag_end, apply_look,
set_border_colours, set_wallpaper and shutdown. The 26 operations that
have shared names and semantics (docs/dev/seam.md section 2.1) are the
shared trait's; KWinBackend and the KDE FakeBackend implement it directly
(supports() is true for every capability, batches are the default no-ops)
and the backend::shared module with its Shared<B> adapter is deleted. The
shared contract tests (check_all and the KDE-specific assertions) now run
against FakeBackend itself. Integration tests import the shared trait to
call the fake's operations.
No behaviour change. Coverage removed with the duplicated declarations:
the doc examples of the KDE set_opacity and set_focus_follows_mouse
(the fake tests and the shared contract still exercise both) and the
'id too wide for u32' wrapper test (the same rule is in KWinBackend raw()).
Verified: KDE cargo test --workspace --no-fail-fast, 878 passed, 0 failed
(native, FakeBackend; was 881 before this revision, the 3 removed tests
are the ones named above). Not run: KDE VM suites.
NetworkConfig, NetworkSelectConfig, InterfaceDisplayType and
DefaultInterfaceConfig move to widgets/network_config.rs (the macOS file had
the first two without default_interface_options). The union NetworkConfig
therefore also has `default_interface_options` on macOS. The macOS schema
view already removes it from the schema, and serde ignored the key before,
so reading a config is unchanged; the macOS network widget now logs a
warning when the key is set ("not supported on macOS and is ignored").
BEHAVIOUR (macOS): one new log line when `default_interface_options` is
configured; nothing else. Needs no gate beyond the Mac hand check listed in
docs/dev/macos-handcheck.md.
Verified: schema harness macOS and Windows byte-identical (3,774 / 9,091
lines; the macOS view is what removes the field); native bar-core tests
3+5; Windows clippy -D warnings --locked clean; macOS fake-CC check
--locked 0 errors.
The seven Komorebi*Config structs (komorebi.rs) and the KomorebiLayout enum
with its hand-written Deserialize and Display (komorebi_layout.rs) are data:
they move to crates/komorebi-bar-core/src/widgets/komorebi_config.rs, which
needs komorebi-layouts (DefaultLayout; schemars forwarded) and color-eyre
in the core: two lines in each Cargo.lock. The two shells re-export them.
The inherent impl of KomorebiLayout (is_default, on_click, show_icon, show,
the egui painting) cannot stay an inherent impl of a foreign type: it
becomes the extension trait `KomorebiLayoutExt` in each shell with the same
bodies; komorebi.rs imports the trait. Because the types are no longer in
the shell file, the two komorebi_layout.rs differ no more than the Windows
one; the macOS widget files keep their own komorebi.rs runtime.
Verified: schema harness macOS and Windows byte-identical (3,774 / 9,091
lines); native bar-core tests 3+5; Windows clippy -D warnings --locked
clean; macOS fake-CC check --locked 0 errors (core files touched first). I
reverted a stray `cargo fmt --all` that had reformatted unrelated files.
Not run: the bars.
Schema-text differences only, so that the config types can move into the
core: the macOS KomorebiLayout gets `#[serde(untagged)]` (its Deserialize is
hand-written and nothing in the bar serializes a layout, so no runtime
effect; it only changes the generated schema and the derived Serialize),
`eyre::Result` and `1.0_f32`; KomorebiFocusedContainerConfig::show_icon gets
the Windows `#[deprecated]` and doc (with `#[allow(deprecated)]` at the one
use). The macOS schema view already sets the macOS text of KomorebiLayout
and show_icon back, so komorebi-for-mac/schema.bar.json and
nix/komorebi-bar-options.nix do not change. The coordinator asked to leave
komorebi_layout alone: this was done because the evidence says it is not a
behaviour difference (custom Deserialize, no serialization anywhere in the
macOS bar: `grep to_string|to_value|to_writer` finds none); it is a separate
revision and can be dropped.
Verified: schema harness macOS and Windows byte-identical (3,774 / 9,091
lines); the two komorebi_layout.rs are byte-identical and the config region
of the two komorebi.rs is identical; Windows clippy -D warnings --locked
clean; macOS fake-CC check --locked 0 errors.
KDE's Backend returned its own WindowInfo/MonitorInfo (plain String and
bool fields) and the Shared wrapper rebuilt the shared ones from them,
the KDE fake did the reverse. The trait now returns komorebi_backend's
types (Option for what a platform may lack); the fake passes the shared
fake's values through and KWin converts its table's records with From.
The plain KDE structs stay as the view the window manager core reads
(Window::info and the monitor loaders convert with From, which fills a
missing field with empty/false and a missing 'normal' with true, exactly
what KDE always had); the shared wrapper is now a pure pass-through,
removed in the next revision. A few test assertions read the Option
fields. No behaviour change.
Verified: KDE cargo test --workspace --no-fail-fast 881 passed, 0 failed
(native, FakeBackend; the one doc test that needed a fix was re-run
and passes). Not run: KDE VM suites.
KeyboardConfig, MediaConfig, SystrayConfig, OverflowTogglePosition,
ButtonPosition, FieldMatch and HiddenIconRule (pure data: serde and schemars
derives, no platform code) move from the Windows widget files to
crates/komorebi-bar-core/src/widgets/platform_config.rs, so that the next
revision can give WidgetConfig a variant for every widget. The Windows
widget files re-export them (`pub use`), so no other file changes; the
runtime halves (Win32, systray_util) stay in komorebi-bar. The core gains the
komorebi-config dependency (for MatchingStrategy; the schemars feature now
forwards to komorebi-config and komorebi-protocol); one line in each
Cargo.lock. Nothing on macOS refers to the types yet, so the macOS schema
cannot change. The schema harness (out of tree) no longer slices systray.rs
by line number.
Verified: schema harness macOS and Windows byte-identical (3,774 / 9,091
lines); native bar-core tests 3+5; Windows clippy -D warnings --locked
clean; macOS fake-CC check --locked 0 errors. Not run: the bars.
Move of the (now byte-identical) applications.rs of both bars to
crates/komorebi-bar-core/src/widgets/applications.rs. Edits: `PathExt` comes
from komorebi_protocol::pathext (what komorebi_client re-exports; it picks
%VAR% handling by target_os), `ImageIcon` from widgets::icons. The core
gains the komorebi-protocol (default features off) and tracing dependencies:
two lines in each Cargo.lock. Both bars re-export the module. 409 lines per
bar are gone. The schema harness now builds a copy of the core next to its
copy of komorebi-protocol (out of tree).
Verified: schema harness macOS and Windows byte-identical (3,774 / 9,091
lines); native bar-core tests 3+5; Windows clippy -D warnings --locked
clean; macOS fake-CC check --locked 0 errors. Not run: the bars.
The two applications.rs differed in how an application icon is found for a
command string. The shared file now asks the platform (new hook
`BarPlatform::command_icon(&str) -> Option<ImageIcon>`). Windows os.rs gets
the former `UserCommand::get_executable` logic verbatim (as the private
`executable_of`) and the windows-icons lookup; macOS returns None, exactly
what its commented-out version did. `1.0` vs `1.0_f32` unified. The two
files are now byte-identical. No schema text changes.
Known and preserved: `UserCommand::launch_if_ready` spawns `cmd /C <command>`
in both bars, so launching an application from the macOS bar is broken (it
was before).
Verified: schema harness macOS and Windows byte-identical; Windows clippy
-D warnings --locked clean; macOS fake-CC check --locked 0 errors. Not run:
the bars.
docs/dev/backend-switch.md now has the table of what is switched (focus,
set_rect with top = false, frame reads, plain hide/restore, minimize,
close, raise, maximize), what is left in the Windows crate on purpose
(top = true set_position, the *_with_border calls, transition and ghost
machinery, set_opacity: border and animation subsystems are platform-owned,
seam.md rule 5), and, for each query not switched (foreground_window,
cursor_pos, monitors, window, monitor_from_point), what the trait would
need so step 9 can decide.
Docs only.
The five window.maximize() / unmaximize() calls in workspace.rs become
let _ = backend().maximize(id, true/false). The trait already has the
capability query (Backend::supports(Capability::Maximize), true on
Windows), so no trait change; the Windows daemon does not need to ask, the
shared core will. WindowsBackend::maximize runs Window::maximize /
unmaximize, which keep the HIDDEN_HWNDS bookkeeping. set_opacity is NOT
switched: the adapter's set_opacity is the plain write, while
Window::transparent/opaque take the alpha from the transparency manager and
animate.
BEHAVIOUR: a dead window is skipped (IsWindow first). e2e gate needed:
maximizing, commands, workspaces. Verified: Windows clippy -D warnings via
tools/fast-check PASS; e2e not run.
Every WindowsApi::window_rect(hwnd) in window_manager.rs becomes
backend().frame(WindowId::from_hwnd(hwnd)). WindowsBackend::frame is
Window::window_rect, i.e. the same DWM call with the Win32 error kept; the
callers' ?, ok(), unwrap_or_default() and is_ok_and() behave as before (only
the error text can differ: a window that died meanwhile reports WindowGone).
BEHAVIOUR: none intended; e2e gate needed: commands, layouts, workspaces, stacking. Verified: Windows clippy
-D warnings via tools/fast-check PASS; e2e not run.
Every WindowsApi::window_rect(hwnd) in border_manager/border.rs becomes
backend().frame(WindowId::from_hwnd(hwnd)). WindowsBackend::frame is
Window::window_rect, i.e. the same DWM call with the Win32 error kept; the
callers' ?, ok(), unwrap_or_default() and is_ok_and() behave as before (only
the error text can differ: a window that died meanwhile reports WindowGone).
BEHAVIOUR: none intended; e2e gate needed: borders. Verified: Windows clippy
-D warnings via tools/fast-check PASS; e2e not run.
Every WindowsApi::window_rect(hwnd) in process_event.rs becomes
backend().frame(WindowId::from_hwnd(hwnd)). WindowsBackend::frame is
Window::window_rect, i.e. the same DWM call with the Win32 error kept; the
callers' ?, ok(), unwrap_or_default() and is_ok_and() behave as before (only
the error text can differ: a window that died meanwhile reports WindowGone).
BEHAVIOUR: none intended; e2e gate needed: commands, lifecycle, resize, move. Verified: Windows clippy
-D warnings via tools/fast-check PASS; e2e not run.
Every WindowsApi::window_rect(hwnd) in animation/ghost.rs becomes
backend().frame(WindowId::from_hwnd(hwnd)). WindowsBackend::frame is
Window::window_rect, i.e. the same DWM call with the Win32 error kept; the
callers' ?, ok(), unwrap_or_default() and is_ok_and() behave as before (only
the error text can differ: a window that died meanwhile reports WindowGone).
BEHAVIOUR: none intended; e2e gate needed: animation scenarios. Verified: Windows clippy
-D warnings via tools/fast-check PASS; e2e not run.
The icon cache (IconsCache, ICONS_CACHE, ImageIcon, ImageIconId,
rgba_to_color_image) was in widgets/mod.rs of both bars with two small
differences: Windows has `Hwnd(isize)`, `SystrayIcon(String)` and `remove`,
macOS has `WindowId(u32)` and a private rgba_to_color_image. The core file
is the Windows one with the macOS variant and `From<u32>` added (an enum
with every variant, as D26 does for WidgetConfig); both bars re-export the
items from widgets/mod.rs so no widget changes. The core gains the `image`
dependency (one line in each Cargo.lock) and a Default impl for IconsCache
(clippy).
Verified: schema harness macOS and Windows byte-identical (3,774 / 9,091
lines); native bar-core tests 3+5; Windows clippy -D warnings --locked
clean; macOS fake-CC check --locked 0 errors (re-run after touching the core
files). Not run: the bars.
Every WindowsApi::window_rect(hwnd) in border_manager/mod.rs becomes
backend().frame(WindowId::from_hwnd(hwnd)). WindowsBackend::frame is
Window::window_rect, i.e. the same DWM call with the Win32 error kept; the
callers' ?, ok(), unwrap_or_default() and is_ok_and() behave as before (only
the error text can differ: a window that died meanwhile reports WindowGone).
BEHAVIOUR: none intended; e2e gate needed: borders. Verified: Windows clippy
-D warnings via tools/fast-check PASS; e2e not run.
Every WindowsApi::window_rect(hwnd) in process_command.rs becomes
backend().frame(WindowId::from_hwnd(hwnd)). WindowsBackend::frame is
Window::window_rect, i.e. the same DWM call with the Win32 error kept; the
callers' ?, ok(), unwrap_or_default() and is_ok_and() behave as before (only
the error text can differ: a window that died meanwhile reports WindowGone).
BEHAVIOUR: none intended; e2e gate needed: commands, resize. Verified: Windows clippy
-D warnings via tools/fast-check PASS; e2e not run.
Every WindowsApi::window_rect(hwnd) in animation/ghost_dispatcher.rs becomes
backend().frame(WindowId::from_hwnd(hwnd)). WindowsBackend::frame is
Window::window_rect, i.e. the same DWM call with the Win32 error kept; the
callers' ?, ok(), unwrap_or_default() and is_ok_and() behave as before (only
the error text can differ: a window that died meanwhile reports WindowGone).
BEHAVIOUR: none intended; e2e gate needed: animation scenarios. Verified: Windows clippy
-D warnings via tools/fast-check PASS; e2e not run.
KDE's Backend took and returned bare u32 ids and answered
window_workspace and current_workspaces without a Result. The operations
that the shared trait has now use komorebi_backend's WindowId and
MonitorId, window_workspace and current_workspaces return its Result, and
the look/drag/wallpaper methods that only KDE has take the same id types.
So the Shared wrapper no longer converts ids or results: it is down to
the window info mapping.
The window manager core keeps its u32 ids (Window { id: u32 }); the
conversion is at the backend call (Window::window_id, From<WindowId> for
Window, WindowId::from_u32 / to_u32 at the remaining call sites). KWin's
table stays keyed by u32; an id too wide for a u32 is a window it never
had (WindowGone, or None for a query). Test call sites got .into() on the
ids and unwrap on the two results. No behaviour change.
Verified: KDE cargo test --workspace --no-fail-fast (unit, integration,
doc) 881 passed, 0 failed, native with FakeBackend. Not run: KDE VM
suites.
Every WindowsApi::window_rect(hwnd) in scrolling.rs becomes
backend().frame(WindowId::from_hwnd(hwnd)). WindowsBackend::frame is
Window::window_rect, i.e. the same DWM call with the Win32 error kept; the
callers' ?, ok(), unwrap_or_default() and is_ok_and() behave as before (only
the error text can differ: a window that died meanwhile reports WindowGone).
BEHAVIOUR: none intended; e2e gate needed: scrolling. Verified: Windows clippy
-D warnings via tools/fast-check PASS; e2e not run.
Every WindowsApi::window_rect(hwnd) in pan.rs becomes
backend().frame(WindowId::from_hwnd(hwnd)). WindowsBackend::frame is
Window::window_rect, i.e. the same DWM call with the Win32 error kept; the
callers' ?, ok(), unwrap_or_default() and is_ok_and() behave as before (only
the error text can differ: a window that died meanwhile reports WindowGone).
BEHAVIOUR: none intended; e2e gate needed: scrolling pan. Verified: Windows clippy
-D warnings via tools/fast-check PASS; e2e not run.
Every WindowsApi::window_rect(hwnd) in live_resize.rs becomes
backend().frame(WindowId::from_hwnd(hwnd)). WindowsBackend::frame is
Window::window_rect, i.e. the same DWM call with the Win32 error kept; the
callers' ?, ok(), unwrap_or_default() and is_ok_and() behave as before (only
the error text can differ: a window that died meanwhile reports WindowGone).
BEHAVIOUR: none intended; e2e gate needed: resize. Verified: Windows clippy
-D warnings via tools/fast-check PASS; e2e not run.
Every WindowsApi::window_rect(hwnd) in animation/snapshot.rs becomes
backend().frame(WindowId::from_hwnd(hwnd)). WindowsBackend::frame is
Window::window_rect, i.e. the same DWM call with the Win32 error kept; the
callers' ?, ok(), unwrap_or_default() and is_ok_and() behave as before (only
the error text can differ: a window that died meanwhile reports WindowGone).
BEHAVIOUR: none intended; e2e gate needed: animation scenarios, workspaces. Verified: Windows clippy
-D warnings via tools/fast-check PASS; e2e not run.
Every WindowsApi::window_rect(hwnd) in stackbar_manager/stackbar.rs becomes
backend().frame(WindowId::from_hwnd(hwnd)). WindowsBackend::frame is
Window::window_rect, i.e. the same DWM call with the Win32 error kept; the
callers' ?, ok(), unwrap_or_default() and is_ok_and() behave as before (only
the error text can differ: a window that died meanwhile reports WindowGone).
BEHAVIOUR: none intended; e2e gate needed: stacking. Verified: Windows clippy
-D warnings via tools/fast-check PASS; e2e not run.
Every WindowsApi::window_rect(hwnd) in stackbar_manager/mod.rs becomes
backend().frame(WindowId::from_hwnd(hwnd)). WindowsBackend::frame is
Window::window_rect, i.e. the same DWM call with the Win32 error kept; the
callers' ?, ok(), unwrap_or_default() and is_ok_and() behave as before (only
the error text can differ: a window that died meanwhile reports WindowGone).
BEHAVIOUR: none intended; e2e gate needed: stacking, layouts. Verified: Windows clippy
-D warnings via tools/fast-check PASS; e2e not run.
process_command (close and minimize of the foreground window, four raise
calls) and monitor_reconciliator (four minimize calls) now call
backend().close/minimize/raise. WindowsBackend runs Window::close,
minimize and raise unchanged (minimize still leaves komorebi-bar alone).
docs/dev/backend-switch.md now holds the full table of what is switched
and what is left, including why the queries (window_rect,
foreground_window, cursor_pos, monitors) were NOT switched: each would drop
an error that callers use or report, or fabricate a default.
BEHAVIOUR: a dead window is skipped by an IsWindow check first; minimize
results are ignored as before. e2e gate needed: commands, monitor
reconciliation (monitor_reconciliator), lifecycle. Verified: Windows clippy
-D warnings via tools/fast-check PASS; e2e not run.
The 23 window.hide() and window.restore() calls (container, workspace,
monitor, process_command, process_event, window_manager) become
let _ = backend().hide(..) / restore(..): WindowsBackend runs Window::hide
and Window::restore, so hiding behaviour (cloak, hide, minimize), border
and HIDDEN_HWNDS bookkeeping are the same. Not switched: hide_with_border
and restore_with_border (the shared trait has no border flag), the
animation transition and ghost dispatcher calls (they run inside the
slide-in machinery), minimize, close, raise and maximize (to follow).
BEHAVIOUR: a window that is already gone is skipped (IsWindow first), so it
is no longer added to HIDDEN_HWNDS or shown; the result is ignored as
before. e2e gate needed: commands, workspaces, stacking, lifecycle_hidden,
minimize/monitor scenarios. Verified: Windows clippy -D warnings via
tools/fast-check PASS; e2e not run.
The two Window::set_position(rect, false) call sites (the workspace
layout update in workspace.rs and the stackbar tab click) now call
backend().set_rect(..), which is Window::set_rect = set_position(rect,
false): the animation, slide-in and live-resize guards are the same.
Not switched: the top = true callers (window.rs move_to_area/center,
workspace.rs maximize area), since the shared set_rect has no top flag, and
all window_rect reads: the shared window_rect is built on window(id), which
asks title, class, exe and path of every window, returns None instead of the
Win32 error and defaults on failure; the 60 call sites rely on Err or
unwrap_or_default, so they stay on WindowsApi::window_rect until the trait
or the adapter has a cheap frame query.
BEHAVIOUR: a dead window fails early with Error::WindowGone, and one
extra IsWindow call per write. e2e gate needed: commands, resize, layouts,
stacking, scrolling, workspaces. Verified: Windows clippy -D warnings via
tools/fast-check PASS; e2e not run.
Switch the 40 Window::focus(mouse_follows)? call sites in process_event,
process_command, workspace, window_manager, focus_manager and the
stackbar click to backend().focus(WindowId::from_hwnd(..), mouse_follows).
WindowsBackend::focus runs Window::focus, so the deferral while a window
slides in, the already-foreground shortcut and the cursor centring are
unchanged. animation/transition.rs:534 stays on Window::focus (it is the
code Window::focus defers to). docs/dev/backend-switch.md records what is
switched.
BEHAVIOUR: a dead window now fails early with Error::WindowGone (before:
the Win32 error from raise_and_focus_window) and a failed focus of a window
that died meanwhile reports WindowGone; every caller uses ? or ignores the
result. e2e gate needed: commands, focus, focus_follows_mouse, stacking,
workspaces, lifecycle. Verified: Windows clippy -D warnings via
tools/fast-check PASS; e2e not run.
A static WindowsBackend behind backend() -> &'static dyn Backend, the way
KDE spells it. Nothing calls it yet; the next revisions switch call sites
one cluster at a time (docs/dev/backend-switch.md).
Not a behaviour change. Verified: Windows clippy -D warnings via
tools/fast-check PASS.
Windows call sites read the frame about 60 times and rely on the Win32
error (or unwrap_or_default). The shared window_rect is built on window(id),
which also asks title, class, exe and path and gives None for every failure.
Add the provided method Backend::frame(id) -> Result<Rect>: WindowGone for
an unknown window, Platform for a failed read. The default goes through
window() (a table lookup on KDE through Shared<B> and on the fake, so the
cached/requested-rect semantics of seam.md section 2 row 2 are kept);
WindowsBackend overrides it with Window::window_rect (one DWM call) and
MacosBackend with MacosApi::window_rect (the two Accessibility reads, no
metadata). The contract tests check frame agrees with window().rect and is
WindowGone for an unknown id; FakeBackend gets a test. A provided method, so
no adapter had to change to compile.
Not a behaviour change (nothing calls it yet). Verified: tools/fast-check
(native crate tests pass, Windows clippy -D warnings, KDE check + lib tests,
macOS fake-CC type-check) PASS; macOS cannot be run here.
docs/dev/bar-unification.md: why config.rs, bar.rs and komorebi.rs are not
moved yet, file by file with the measured difference (differing lines and
hunks), the structural blocker (two Cargo workspaces/lockfiles/flakes, two
komorebi-client crates), the schema views that settle schema.bar.json, the
ordered plan, KDE (no bar exists), the macOS commands that spawn cmd.exe or
explorer.exe and are preserved in os.rs, and what must be checked by hand on
Windows and on a Mac.
Verified: figures from diff on this tree; no code changed. Gates at this
tip: schema harness macOS and Windows byte-identical, native bar-core tests
3+5 passed, Windows clippy and macOS fake-CC check clean.
Pure move of the (now byte-identical) time.rs of both bars into
crates/komorebi-bar-core/src/widgets/time.rs; the only edit is the path of
Alignment. komorebi-bar-core gains the lazy_static dependency (TIME_RANGES);
Cargo.lock of the root and of komorebi-for-mac get that one line. Both bars
re-export the module. 541 lines per bar are gone.
Verified: schema harness: macOS byte-identical (3,774 lines), Windows
byte-identical (9,091 lines); native bar-core tests 3+5 passed; Windows
clippy -D warnings clean (--locked); macOS fake-CC check --locked 0 errors.
Not run: the bars.
The two time.rs differed in three lines: a `default = false` schema
attribute on changing_icon and the variant title "Default" for
TimeFormat::Custom (both only in the macOS file; the title is a macOS
mislabel), and `1.0` vs `1.0_f32` (same type). The macOS source now reads
as the Windows one; the macOS schema view (komorebi_bar_core::schema) sets
the macOS text back, so komorebi-for-mac/schema.bar.json and
nix/komorebi-bar-options.nix are unchanged. The two files are now
byte-identical.
Verified: schema harness: macOS byte-identical (3,774 lines), Windows
byte-identical (9,091 lines); Windows clippy -D warnings clean; macOS
fake-CC check 0 errors.
Pure move of the (now byte-identical) storage.rs of both bars into
crates/komorebi-bar-core/src/widgets/storage.rs; the only edit is the path
of Alignment (crate::bar::Alignment -> crate::alignment::Alignment). Both
bars re-export it (`pub use komorebi_bar_core::widgets::storage`), so no
other file changes. 207 lines per bar are gone.
Verified: schema harness: macOS byte-identical (3,774 lines), Windows
byte-identical (9,091 lines); native bar-core tests 3+5 passed; Windows
clippy -D warnings clean; macOS fake-CC check 0 errors. Not run: the bars.
Window already had focus, raise, hide, restore, minimize and close under
the names of the shared Backend trait (docs/dev/seam.md section 2). Add
the four that were missing as thin delegates: set_rect (set_position with
top = false), alive (is_window), window_rect (WindowsApi::window_rect) and
unminimize (WindowsApi::restore_window). No call site changes; the
unused-by-the-daemon WindowsBackend now calls the new names.
Not a behaviour change. Verified: Windows clippy -D warnings via
tools/fast-check PASS.
window_is_eligible (window.rs) took regex, ignore, manage, floating, then
layered, no-titlebar and slow; apply_globals (static_config.rs) took
ignore, regex, manage and the rest in yet another order: a rule check and
a config load could wait for each other for ever (the KDE tree hit this,
see ef1d3ef0 there).
One order is now documented at the statics in lib.rs: floating, session
floating, transparency, ignore, manage, layered, tray, object-name-change
(two), slow, no-titlebar, workspace rules, regex (a leaf: every rule check
takes its list and then the regexes). window_is_eligible takes the lists it
reads up front in that order and, once it has matched them all, drops every
guard BEFORE the slow-application sleep (before this, the sleep ran with
the regex, ignore, manage, floating, layered and no-titlebar guards held, so
a config load or rule command waited out the compensation time); apply_globals
is reordered. Every other site that nests two of these (state.rs,
process_command.rs session float rules, process_event.rs,
window_manager_event.rs, transparency_manager.rs, window_manager.rs,
workspace.rs) already followed the order.
BEHAVIOUR: lock acquisition order and hold time only; no rule semantics
change. Gate needed: Windows e2e commands and config_reload. Verified: not
yet re-run after the guard-drop change.
The two storage.rs differed in the click handler and in four doc strings.
The click now asks the platform (new SystemTool::StorageLocation(label)) and
each shell keeps exactly what it spawned: Windows `cmd.exe /C explorer.exe
<first word of the label>`, macOS `open <label without its last word>`. The
macOS doc strings take the Windows spelling (C:\, Local Disk); the macOS
schema view sets the macOS text back, so komorebi-for-mac/schema.bar.json
and nix/komorebi-bar-options.nix do not change.
Verified: schema harness S/bar2/regen.sh: macOS byte-identical (3,774
lines), Windows byte-identical (9,091 lines); the two storage.rs are now
byte-identical to each other; Windows clippy -D warnings clean; macOS
fake-CC check 0 errors. No click was exercised (cannot here).
Adds the three BEHAVIOUR-relevant registry revisions (registration and
forgetting, native-tab sync) with what to look for on a Mac, the mechanical
ones to section B, and a status entry in the bug list saying what of step
11(ii) is done and what is deliberately not (animator lanes, borders,
reaper/live-resize timeouts, the model holding bare ids).
Verified: documentation only.
Step 11(ii), fifth part. window_manager.rs cloned the dragged window's
element out of the workspace only to call MacosApi::window_rect on it; it
now asks the Window found in the container for window_rect (the same call on
the same element). One raw AX site fewer outside Window. The error is the
same one the old call returned, still propagated with ?. Not behaviour.
Verified: macOS fake-CC type-check (tools/fast-check) PASS. Not verified:
cannot run on Linux.
Step 11(ii), fourth part. The seven sites that derive a CGWindowID from an
element that the system handed over (event tap, observer callbacks, the
focused window of an app, the tab check) call ax_registry::identify instead
of AccessibilityApi::window_id: input_event_listener.rs, process_command.rs,
process_event.rs (5), window_manager.rs. It is the same call; the point is
that an element becomes an id only here, which is the key the registry is
filled under. Not behaviour: nothing changes at runtime.
Verified: macOS fake-CC type-check (tools/fast-check) PASS. Not verified:
cannot run on Linux.
Step 11(ii), third part. BEHAVIOUR (bookkeeping only). The two places in
process_event.rs that swap a window's id and element in place when a native
tabbed application shows another tab now call ax_registry::sync(old_id,
window): the old id is forgotten and the window registered as it now is, so
the table never names an element that the model has replaced. No AX call is
added.
Verified: macOS fake-CC type-check (tools/fast-check) PASS. Not verified:
cannot run on Linux. Gate needed: Mac hand check with a tabbed app
(Terminal or Finder tabs; see docs/dev/macos-handcheck.md): switch tabs,
close the first tab, focus the window by command; behaviour must match the
baseline.
Step 11(ii), second part. BEHAVIOUR (memory and bookkeeping only; no AX call
is added anywhere, and no existing call reads the table yet except the
still-unused MacosBackend).
Window::new registers the window under its id. Entries end where the daemon
learns of a death: Window::drop when the window is no longer alive (next to
the InvalidWindow notification it already sends), reap_window in the reaper,
and WindowManagerEvent::Destroy for NSWorkspaceDidTerminateApplication
(forget_pid, next to enhanced_ui::forget: a new process may reuse the pid).
A live window that is never managed stays registered until it dies or its
application quits; the table holds retained references that the Window clones
held anyway. The native tab case (id and element changed in place) follows in
its own revision.
Verified: macOS fake-CC type-check (tools/fast-check) PASS. Not verified:
cannot run on Linux. Gate needed: the Mac hand check, see
docs/dev/macos-handcheck.md (open and close many windows and quit apps; the
daemon's memory must not grow; nothing else should look different).