Commit Graph
2548 Commits
Author SHA1 Message Date
LGUG2Z 1b3b33fb2c chore(repo): combine the kfde, bar and settings stacks (staging)
Staging merge of three stacks that make no runtime change on Windows or KDE: the KDE Backend/Container/process_command refactors (wip-u-kfde), the shared bar core moves (wip-u-bar) and komorebi-settings with the S1/S2 pins (wip-u-settings). Conflicts, if any, are resolved here. Not yet gated: the KDE VM suites and the Windows bar check are owed.
2026-10-31 11:25:59 -07:00
LGUG2Z 495c4f2e0d feat(macos): install the settings handle
New module settings.rs: MacosSettings (empty platform part) and settings(),
a LazyLock<Handle<MacosSettings>> starting from Shared::defaults_for(
PlatformDefaults::MACOS). Nothing reads it yet, so nothing changes at
runtime. A test pins that the starting settings equal the starting values of
the statics (as for KDE); it is type-checked only, because macOS tests
cannot run on this host. Plan step 10, S2. Pure refactor.

Verified: macOS fake-CC cargo check --locked --target aarch64-apple-darwin
--workspace --all-targets: 0 errors. The pin test was not run (no Mac).
2026-10-31 11:25:29 -07:00
LGUG2Z fe2febed56 refactor(macos): take the default constants from komorebi-settings
DEFAULT_RESIZE_DELTA, DEFAULT_MOUSE_FOLLOWS_FOCUS and the initial values of
DEFAULT_WORKSPACE_PADDING and DEFAULT_CONTAINER_PADDING now come from
komorebi_settings::shared (PlatformDefaults::MACOS); the statics keep their
names and types, so no reader changes. Adds the komorebi-settings path
dependency (Cargo.lock +1 package). Plan step 10, S1. Pure refactor: same
values (50, true, 5, 5). BORDER_OFFSET_ADJUSTMENT stays where it is: it is a
macOS-only constant (the platform part, later).

Verified: macOS fake-CC cargo check --target aarch64-apple-darwin
--workspace --all-targets: 0 errors (type-check only; nothing linked or run;
no Mac).
2026-10-31 11:25:29 -07:00
LGUG2Z b7b95320ee feat(kde): install the settings handle
New module settings.rs: KdeSettings (empty platform part) and settings(), a
LazyLock<Handle<KdeSettings>> starting from Shared::defaults_for(
PlatformDefaults::KDE). Nothing reads it yet, so nothing changes at runtime.
A test pins that the starting settings equal the starting values of the
statics (paddings, resize delta, mouse follows focus, border enabled/width/
offset/radius and the six colours), so that S3 and S6 can move each group
over without changing a default. Plan step 10, S2. Pure refactor.

Verified: KDE cargo test -p komorebi --lib --tests (lite env, own target
dir): all test binaries ok, 0 failed, including the new pin. KDE VM suites
not run.
2026-10-31 11:25:29 -07:00
LGUG2Z 3a287fcf0d refactor(kde): take the default constants from komorebi-settings
DEFAULT_RESIZE_DELTA, DEFAULT_MOUSE_FOLLOWS_FOCUS and the initial values of
DEFAULT_WORKSPACE_PADDING and DEFAULT_CONTAINER_PADDING now come from
komorebi_settings::shared (PlatformDefaults::KDE); the statics keep their
names and types, so no reader changes. Adds the komorebi-settings path
dependency (workspace and package manifest, Cargo.lock +1 package).
Plan step 10, S1 (docs/dev/settings.md section 5). Pure refactor: same
values (50, true, 5, 5), pinned by the crate's platform-defaults test.

Verified: KDE cargo test -p komorebi --lib --tests (lite env, own target
dir): all test binaries ok, 0 failed. KDE VM suites not run.
2026-10-31 11:25:29 -07:00
LGUG2Z fb145f96a8 feat(settings): add the shared settings and the load merge
Shared now holds every non-platform setting of docs/dev/settings.md 2.1:
border (enabled, width, offset, radius, six colours), animation (global and
per-prefix enabled, style, duration; fps; Animation::motion_for reading all
three from one snapshot), paddings and constants, transparency, floating
window aspect ratio, layout defaults, display index preferences, with the
per-platform defaults (PlatformDefaults::{WINDOWS, KDE, MACOS}: border 8/10/10
and -1/0/0, padding 10/5/5). SharedDelta::apply reproduces what
StaticConfig::apply_globals does with each key: absent keys keep the old value
(border, paddings, transparency, display preferences, a missing animation
block), absent layout_defaults and floating_window_aspect_ratio reset (the
latter to Standard although the static starts at Widescreen), an animation
block without fps resets fps, a global animation value clears its per-prefix
map and a map replaces the whole map.

No daemon uses the crate yet.

Verified: native cargo test -p komorebi-settings: 18 passed (9 handle, 9
shared: defaults per platform, default colours equal the komorebi-themes
conversion, keep-versus-reset per key, animation merge, motion_for);
clippy clean for the crate. The tests encode what apply_globals does as read
on wip-main; they were not run against the daemons.
2026-10-31 11:25:28 -07:00
LGUG2Z 1fb5e74fe3 feat(settings): add komorebi-settings with the snapshot handle
New crate crates/komorebi-settings (workspace member, Cargo.lock +1
package, no new third-party dependency). Settings<P> is a shared part and a
platform part P; Handle<P> holds the current value as an Arc that readers
snapshot once per unit of work and writers replace through update (writers
serialised, one publish, nothing published if the edit panics). Handle::scoped
sets one field and restores the previous value on drop only if the field
still holds the value it set, replacing the save-and-restore store pairs in
the daemons (Windows WINDOW_HANDLING_BEHAVIOUR, KDE ANIMATION_ENABLED_GLOBAL).
Shared starts with the border and the per-platform defaults; the rest follows
in the next revision. See docs/dev/settings.md.

No daemon uses the crate yet.

Verified: native cargo test -p komorebi-settings: 9 passed (snapshot
isolation, concurrent updates lose nothing, no torn reads under a writer,
scoped restore and 'change made meanwhile wins'); clippy clean for the crate.
komorebi-config warns about an unused import when built without its schemars
feature (not touched here). KDE, macOS and Windows trees not touched.
2026-10-31 11:25:28 -07:00
LGUG2Z 0a823eec94 docs(settings): inventory of the process-wide statics and the Settings design
Measured on wip-main 633e7453 by grep and reading: 126 (Windows), 53 (KDE)
and 74 (macOS) static declarations, of which 61/35/36 are configuration and
51/29/28 are written by apply_globals. The document has the per-static
table (type, writers, readers, shared or platform, matching name), the lock
order of the rule lists, the proposed Settings (shared part plus a platform
type parameter, snapshot reads, serialised updates, scoped override), the
statics whose semantics would change (reload merges rather than replaces;
partial updates visible mid-reload; save-and-restore writes; the empty
WORKSPACE_MATCHING_RULES window), the migration order with pure refactor
versus BEHAVIOUR marks and the gate each needs, and section 7 with the
findings from encoding the semantics in the crate (aspect ratio starts at
Widescreen but a load without the key writes Standard).

Verified: nothing run (documentation); counts from grep, line numbers read
at 633e7453.
2026-10-31 11:25:26 -07:00
LGUG2Z 6a548f4f62 docs: compare the KDE and Windows core model and propose komorebi-core
docs/dev/core-model.md: per-file measured differences between the
Windows, KDE and macOS container, monitor, workspace, window and
window_manager (stripped code lines, changed lines, identical lines),
the platform-specific fields and methods of each layer, a proposed
split into a komorebi-core crate generic over a Platform (Backend plus a
Copy-or-Clone Window and a state type) with the exact order of layers
(container, monitor, workspace, window_manager, router), what the KDE
stack of wip-u-kfde already did, what Windows must do before the crate
can be created, and the list of KDE process_command arms over 20 lines
with the method each became. Measurements are from diff of the files at
this tip; nothing was run on Windows or macOS.

Verified: not applicable (documentation); the numbers were produced by
diff and wc on the files at wip-u-kfde.
2026-10-31 11:09:17 -07:00
LGUG2Z be6cfab24c refactor(kde): query, configuration and border-colour commands are named methods
Plan step 9 prerequisite, last cluster of process_command: Query (51
lines) becomes answer_query(query, reply), ReplaceConfiguration (34)
becomes replace_configuration(config), BorderColour (21) becomes
set_border_colour(kind, r, g, b). After this no arm of KDE's
process_command is longer than 20 lines (the only longer one is the
list of not-supported messages, which has no logic). Bodies are the
arms' bodies, dedented. No behaviour change.

Verified: KDE cargo test -p komorebi --lib --tests (native, FakeBackend):
633 passed, 0 failed. Not run: doc tests, VM suites.
2026-10-31 11:08:13 -07:00
LGUG2Z 65c8e92b05 refactor(kde): rule commands of process_command are named methods
Plan step 9 prerequisite: SessionFloatRule (39 lines), IgnoreRule (55),
NamedWorkspaceRule (21) and InitialNamedWorkspaceRule (21) become
add_session_float_rule(), add_ignore_rule(identifier, id),
add_named_workspace_rule(identifier, id, workspace) and
add_initial_named_workspace_rule(identifier, id, workspace). Bodies are
the arms' bodies, dedented, plus Ok(()). No behaviour change.

Verified: KDE cargo test -p komorebi --lib --tests (native, FakeBackend):
633 passed, 0 failed. Not run: doc tests, VM suites.
2026-10-31 11:05:55 -07:00
LGUG2Z f1ff3d3df8 refactor(kde): resize and layout-ratio commands are named methods
Plan step 9 prerequisite: ResizeWindowAxis (60 lines) becomes
resize_window_axis(axis, sizing), LayoutRatios (23 lines) becomes
set_layout_ratios(columns, rows), and
ToggleWorkspaceWindowContainerBehaviour (21 lines) becomes
toggle_workspace_window_container_behaviour(). Bodies are the arms'
bodies, dedented, plus Ok(()). No behaviour change.

Verified: KDE cargo test -p komorebi --lib --tests (native, FakeBackend):
633 passed, 0 failed. Not run: doc tests, VM suites.
2026-10-31 11:04:02 -07:00
LGUG2Z 54d9f1c8c3 refactor(kde): EagerFocus and ToggleWorkspaceLayer are named methods
Plan step 9 prerequisite, next cluster of process_command: the 75-line
EagerFocus arm becomes WindowManager::eager_focus(exe) and the 90-line
ToggleWorkspaceLayer arm becomes toggle_workspace_layer(). Bodies are
the arms' bodies, dedented, plus Ok(()). No behaviour change.

Verified: KDE cargo test -p komorebi --lib --tests (native, FakeBackend):
633 passed, 0 failed. Not run: doc tests, VM suites.
2026-10-31 11:02:31 -07:00
LGUG2Z 683c1c4b0c refactor(kde): workspace-focus commands of process_command are named methods
Plan step 9 prerequisite: the multi-line arms of process_command become
methods of WindowManager. This cluster: CycleFocusWorkspace
(cycle_focus_workspace), CycleFocusEmptyWorkspace
(cycle_focus_empty_workspace), CloseWorkspace (close_workspace) and the
twin arms MoveContainerToLastWorkspace and SendContainerToLastWorkspace,
which were the same 27 lines but for the follow flag, now one method
move_container_to_last_workspace(follow). The bodies are the arms'
bodies, dedented, plus Ok(()). No behaviour change.

Verified: KDE cargo test -p komorebi --lib --tests (native, FakeBackend):
633 passed, 0 failed. Not run: doc tests, VM suites.
2026-10-31 11:00:21 -07:00
LGUG2Z 1c3221e6b6 docs(bar): status after the config move, merged package layout, macOS hand check
docs/dev/bar-unification.md is brought up to date: what the core holds now
(4,592 lines, the hooks), what is still per platform with fresh
measurements (komorebi.rs 136 differing lines, network.rs 82, bar.rs 444,
main.rs 92, os.rs 71) and why each stays, the known macOS/Windows
differences kept on purpose (including the accept-and-skip of Windows-only
keys, D-coord-1), the proposed layout of the merged package for the
coordinator (module layout with cfg(target_os), dependencies by target,
schema flag, lock-file folding, nix), the ordered plan and the hand check
list. No code changed. The macOS hand-check section for
docs/dev/macos-handcheck.md (owned by kfm, not in this tree) is in the
scratchpad as bar-handcheck-section.md for the coordinator to append.

Verified: figures from diff on this tree. Gates at this tip: native bar-core
tests 3+6, schema harness macOS and Windows byte-identical, Windows clippy
and macOS fake-CC check clean.
2026-10-31 10:57:18 -07:00
LGUG2Z 3603926f0e refactor(kde): order monitor.rs like the Windows monitor
Pure move, no behaviour change: struct Monitor first, then
impl_ring_elements!, then MonitorInformation and its From impl, as in
komorebi/src/monitor.rs. Field order and field sets are untouched (the
derive order is the JSON order of the state, and Windows' extra fields
name, device_id and workspace_names are content, not layout; 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.
2026-10-31 10:56:57 -07:00
LGUG2Z 91840eb34f refactor(bar-core): move the komorebi layout widget into the core
The two komorebi_layout.rs were identical except for the position of one
`pub use`. The widget moves to
crates/komorebi-bar-core/src/widgets/komorebi_layout.rs together with the
KomorebiLayoutExt trait; the shells re-export the module. Its three
komorebi_client calls go through the platform seam: new hook
`BarPlatform::send_komorebi_message` (next to send_komorebi_batch), which
both os.rs implement as `komorebi_client::send_message`, so each bar sends
exactly what it sent. DefaultLayout and SocketMessage come from
komorebi-layouts and komorebi-protocol (what komorebi_client re-exports).
About 290 lines per bar are gone.

Verified: native bar-core tests 3+6; 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 (files touched first). Not
run: the bars; clicking the layout widget is unverified on both.
2026-10-31 10:56:04 -07:00
LGUG2Z ace81232a5 refactor(kde): container operations have the Windows signatures
Container::add_window takes the Window by value, and hide, restore and
load_focused_window return nothing (hide and restore take &self), as in
komorebi/src/container.rs. The KDE versions returned eyre::Result that
was always Ok (their docs said so) and callers wrote ? or unwrap on it;
those are gone, as is the eyre import of container.rs. Each operation
still does what it did: the same windows are hidden and restored in the
same order. No behaviour change.

Verified: KDE cargo test -p komorebi --lib --tests (native, FakeBackend):
633 passed, 0 failed. Not run: doc tests, VM suites.
2026-10-31 10:55:26 -07:00
LGUG2Z ef89899bd9 refactor(bar-core): move config.rs (KomobarConfig and the mouse options) into the core
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.
2026-10-31 10:54:51 -07:00
LGUG2Z afa7fcd219 refactor(mac-bar): converge config.rs onto the Windows source
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.
2026-10-31 10:53:10 -07:00
LGUG2Z 0ec3bc8399 refactor(kde): order container.rs like the Windows container
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.
2026-10-31 10:53:02 -07:00
LGUG2Z 7e61c3a934 refactor(bar): reach exec_powershell and send_batch through BarPlatform hooks
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.
2026-10-31 10:52:09 -07:00
LGUG2Z 4831a6c3ab refactor(bar-core): WidgetConfig with a variant for every widget lives in the core
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.
2026-10-31 10:51:02 -07:00
LGUG2Z 42d8ea4656 refactor(kde): remove the Shared wrapper, KDE's Backend extends the shared one
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.
2026-10-31 10:50:39 -07:00
LGUG2Z a57648f36d refactor(bar-core): move the network widget config types into the core
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.
2026-10-31 10:48:17 -07:00
LGUG2Z c2e6b01f89 refactor(bar-core): move the komorebi widget config types and KomorebiLayout into the core
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.
2026-10-31 10:47:01 -07:00
LGUG2Z cb8fc00afb refactor(mac-bar): converge komorebi.rs config text and komorebi_layout.rs onto the Windows source
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.
2026-10-31 10:43:56 -07:00
LGUG2Z 68d1e49442 refactor(kde): the Backend answers with the shared WindowInfo and MonitorInfo
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.
2026-10-31 10:43:55 -07:00
LGUG2Z e1820d9bbe refactor(bar-core): move the config types of the Keyboard, Media and Systray widgets into the core
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.
2026-10-31 10:42:45 -07:00
LGUG2Z a290449763 refactor(bar-core): move the applications widget into komorebi-bar-core
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.
2026-10-31 10:40:07 -07:00
LGUG2Z 1bc806c9d9 refactor(bar): converge applications.rs of both bars behind BarPlatform::command_icon
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.
2026-10-31 10:35:25 -07:00
LGUG2Z 0c197e8652 refactor(bar-core): move ImageIcon, ImageIconId and the icons cache into the core
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.
2026-10-31 10:30:21 -07:00
LGUG2Z c08ee2cfae refactor(kde): the Backend names windows and monitors with the shared ids
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.
2026-10-31 10:29:23 -07:00
LGUG2Z e7cf89d8f5 docs(bar): the plan for one komorebi-bar, with measured blockers
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.
2026-10-31 10:22:30 -07:00
LGUG2Z 60fcd3071a refactor(bar-core): move the time widget into komorebi-bar-core
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.
2026-10-31 10:18:21 -07:00
LGUG2Z 3c5dac814c refactor(mac-bar): converge time.rs onto the Windows spelling
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.
2026-10-31 10:15:33 -07:00
LGUG2Z d8aa0dcd62 refactor(bar-core): move the storage widget into komorebi-bar-core
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.
2026-10-31 10:14:41 -07:00
LGUG2Z bfddb6f0c3 refactor(bar): converge storage.rs of both bars behind a platform hook
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).
2026-10-31 10:13:25 -07:00
LGUG2Z 06ce5adfe8 refactor(kde): the Backend fails with the shared Error
KDE's Backend trait returned eyre reports and the Shared wrapper turned
them into komorebi_backend::Error (guessing WindowGone from is_window
afterwards). The 16 operations that the shared trait has now return
komorebi_backend::Result themselves: KWinBackend says WindowGone for an
id it has no uuid for and Platform for everything else, and the fake
passes the shared fake's errors through. Window's commands (set_position,
focus, raise, close, minimize, ...) return the shared Result too. KDE-only
methods (look, border colours, wallpaper) keep eyre.

Only the text of a failure changes ("no such window: 9" instead of
"there is no such window" in logs); no control flow does.

Verified: KDE cargo test --workspace --no-fail-fast, 881 passed, 0 failed
(native, FakeBackend). Not run: KDE VM suites.
2026-10-31 10:09:49 -07:00
LGUG2Z 352cda3be3 refactor(bar): print --schema through the platform view
Both bars now print `schema.bar.json` as the view of the generated union
schema (komorebi_bar_core::schema::generated_text): Windows through the
Windows view (the identity), macOS through the macOS view. The sources of
both bars are still separate, so the generated text is what it was and the
macOS changes set what is already there (they are idempotent); this is the
switch that lets the next revisions move code that differs only in schema
text into the core in the Windows spelling.

Verified: out-of-tree schema harness (S/bar2/regen.sh, real sources, bins
updated to call generated_text): macOS byte-identical to
komorebi-for-mac/schema.bar.json (3,774 lines), Windows byte-identical to
schema.bar.json (9,091 lines). Native bar-core tests 3+5 passed, Windows
clippy -D warnings clean, macOS fake-CC check 0 errors. The binaries were
not run (cannot on Linux).
2026-10-31 10:09:33 -07:00
LGUG2Z 280eea6fec feat(bar-core): per-platform views of one union bar schema
The Windows schema.bar.json is the union of the bar configuration (every
widget, the mouse options, Windows spelling). New module `schema` holds the
macOS view as data: 16 changes (set text/defaults that read differently,
remove the mouse property, the Keyboard/Media/Systray widget variants and
the NetworkConfig default_interface_options) followed by pruning of the
definitions nothing refers to any more. Same design as komorebi-config
(schema.rs, changes.rs); the changes are idempotent so a bar can print its
own generated schema through its view.

Nothing uses the views yet; no bar source changed.

Verified: native `cargo test -p komorebi-bar-core` 3 unit + 5 oracle passed
(new: the macOS view of the checked-in Windows file is byte-identical to
komorebi-for-mac/schema.bar.json; the Windows view is the Windows file; a
view is idempotent). Windows clippy -D warnings clean; macOS fake-CC check
0 errors. Not verified: nothing rendered.
2026-10-31 10:00:37 -07:00
LGUG2Z 633e7453cd chore(nix): regenerate the KDE options file from the current schema
Regenerated komorebi-for-kde/nix/komorebi-options.nix from schema.json with schemars-nixgen (50ce286: sorted output, hash first line) and nix fmt. The checked-in file was stale after steps 2 and 3 changed description lines in the schema. Verified: nix build of kfde-schema-fresh and kfde-nix-options-validation from the root flake both succeed.
2026-10-31 08:45:32 -07:00
LGUG2Z 9c3dcf8159 chore(nix): regenerate the macOS options files with the hash line
Regenerated komorebi-options.nix and komorebi-bar-options.nix from schema.json and schema.bar.json with schemars-nixgen (50ce286: sorted output, hash first line), then nix fmt from the root flake's formatter because the macOS flake has none on Linux. The generator was not run from the macOS tree's own just recipe. Verified: not built or evaluated on macOS; the macOS flake has no schema-fresh check, so the hash line is informational.
2026-10-31 08:45:32 -07:00
LGUG2Z a415922a46 build(kde): let schemars-nixgen write the schema hash line in nixgen
schemars-nixgen now writes the `# schema-sha256:` first line itself (schemars-nixgen 50ce286), so the justfile's printf and mv step would add a second one. Removes them and updates the comment. Verified: 'just nixgen' itself was not run (the recipe also builds a check); the same steps by hand gave a first line equal to `nix hash file --type sha256 --base16 schema.json`.
2026-10-31 08:45:32 -07:00
LGUG2Z 83819b22b1 docs(backend): focus is one call on Windows and macOS too
The doc of Backend::focus said Windows and macOS do focus and then center_cursor_in; writing the adapters showed that Window::focus on both takes mouse_follows_focus and centres the pointer itself (Windows also defers the focus while the window slides in). Doc comment only.

Verified: see the gates below; native cargo test -p komorebi-backend passes (doctests unchanged).
2026-10-31 01:37:54 -07:00
LGUG2Z 7260c9f772 docs(seam): findings from the 7c adapters (section 9)
Appends section 9 to docs/dev/seam.md: for each method of the shared Backend, what WindowsBackend and MacosBackend do and where that differs from what the daemon calls today (windows() and macOS's registry cannot be written faithfully; set_rect on Windows drops the top flag and keeps animation and guards; hide/restore results are ignored on Windows; macOS hide needs a corner and a display; raise on macOS also focuses; macOS monitors() has to be a main-thread-refreshed cache; set_opacity on Windows is the plain write). Concludes that the trait did not have to change and records three proposals (rect as Option, hide's hidden inputs, windows() as start-up operation).

Verified: docs only, not built. Every claim is by reading the code while writing the adapters; what could not be settled by reading is marked 'not verified' in the text.
2026-10-31 01:37:54 -07:00
LGUG2Z bd3454e433 feat(macos): MacosBackend, a compile-only adapter for the shared Backend
komorebi::macos_backend::MacosBackend implements komorebi_backend::Backend over the existing MacosApi, Window and AdhocWindow functions. It is NOT used by the daemon (no call site changed; that is step 11). No capability is supported (workspaces, maximize, opacity and focus-follows-mouse answer Unsupported).

Because nothing on macOS acts from a bare id, the adapter owns the id registry of seam.md consequence (1): the daemon would register(Window) and forget(id), every method looks the Window up by id and an unknown id is WindowGone. monitors() reads a cache that refresh_monitors(MainThreadMarker) fills on the main thread (the TARGET rule: no Backend method waits for main; the live NSScreen query panics off main). begin_batch/end_batch hold a stack of SkyLight BatchedUpdates guards. The parts that cannot be written faithfully (windows() is the registry, hide needs a corner and a display the trait has no place for, raise also focuses, no minimized/alive query that does not round-trip to the app, ...) are commented where they are and listed in seam.md section 9 (next revision).

komorebi-for-mac gains the komorebi-backend path dependency (workspace dependency, komorebi/Cargo.toml, Cargo.lock).

Verified: macOS fake-CC cargo check --locked --target aarch64-apple-darwin --workspace --all-targets: finished, 0 errors, no warning in macos_backend.rs. Not run: unit tests (macOS code cannot run here).
2026-10-31 01:37:54 -07:00
LGUG2Z 76d25c8843 feat(windows): WindowsBackend, a compile-only adapter for the shared Backend
komorebi::windows_backend::WindowsBackend implements komorebi_backend::Backend over the existing static WindowsApi and Window methods. It is NOT used by the daemon (no call site changed; that is step 8). A window is WindowId::from_hwnd(hwnd) (every bit kept), a monitor MonitorId::from_hmonitor; maximize, opacity and focus-follows-mouse are supported, the five workspace methods answer Unsupported, batches are no-ops.

Methods that cannot be written without a difference in semantics are commented where they are and will be listed in docs/dev/seam.md section 9 (next revision): set_rect (the top flag is dropped; Window::set_position keeps its animation, slide-in, live-resize guard and same-frame skip), hide/restore/minimize/unminimize/maximize (ShowWindow results are ignored, so only an IsWindow pre-check can say WindowGone; hide and restore also drive the border and HIDDEN_HWNDS), windows() (alt-tab list, not the core's filtered candidates), set_opacity (plain write, not the animated, globally-configured Window::transparent), monitor_from_point (nearest monitor, never None).

Verified: nix develop cargo clippy --workspace --locked --all-targets -- -D warnings finished with no warnings or errors. Not run: unit tests (Windows code cannot run here).
2026-10-31 01:37:54 -07:00
LGUG2Z 9bf77e32b9 feat(kde): KDE backends implement the shared Backend through Shared
komorebi::backend::shared::Shared<B> wraps any KDE Backend (the KWin one, the fake, a dyn Backend) and implements komorebi_backend::Backend over it, so KDE is the first implementation of the shared trait without any change to its own trait or call sites. Ids are WindowId::from_u32 (an id wider than u32 is a window KDE never had); a failed window command becomes Error::WindowGone when the window is no longer alive and Error::Platform(report) otherwise; every optional field is Some; every Capability is supported; batches are no-ops (KDE batches by construction).

Tests (5, in backend/shared.rs): the KDE fake, through Shared, passes the shared contract (check_all); the error mapping; wide ids; every capability supported; fields coming through.

Verified: komorebi-for-kde cargo test --workspace --no-fail-fast: 881 passed, 0 failed over 80 binaries (876 baseline + these 5). clippy -D warnings on komorebi-for-kde reports 3 ptr_arg errors in static_config.rs that predate this work; none in backend/.
2026-10-31 01:37:54 -07:00
LGUG2Z 1497e5d62a refactor(kde): the fake backend wraps komorebi-backend's FakeBackend
komorebi::backend::fake::FakeBackend (and Command) keep their paths, signatures (u32 ids, eyre errors, the 18-variant Command) and behaviour, but the desktop is now komorebi_backend::fake::FakeBackend. The KDE type wraps it and translates ids and errors ('no such window: <id>' text is unchanged); the commands and state that only KDE has (apply_look, set_border_colours, set_wallpaper, drag_end and their getters) stay in the wrapper, and their commands are logged in the shared fake's log (Command::Ext) so their order among the others is kept. KDE's own trait Backend is untouched: that is the least invasive route, no call site and no test body changes (the 26 unit tests of fake.rs stay in the file byte for byte and now test the wrapper).

Cargo: komorebi-for-kde gains the komorebi-backend path dependency (workspace dependency plus komorebi/Cargo.toml; Cargo.lock updated).

Verified: in komorebi-for-kde, cargo test --workspace --no-fail-fast: 876 passed, 0 failed over 80 binaries (identical to the baseline; counts unchanged because the fake.rs tests were kept and the crate's tests are additional). The shared crate's own tests are counted separately.
2026-10-31 01:37:54 -07:00