From bbd374ae2451bebba10b01086e0498ebfc50d0bd Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Wed, 28 Oct 2026 20:00:00 -0700 Subject: [PATCH] feat(flavor): komorebi for KDE, with rules written from its source Flavor::Kde is the flavor of a Linux host. Its rules are checked against a log and events of komorebi for KDE's in-memory desktop, but not against a real desktop, so an analysis of a KDE session says so. There are no ghost tiles for it yet. --- komorebi-recorder/src/analysis/catalog.rs | 2 + komorebi-recorder/src/analysis/flavor/kde.rs | 471 ++++++++++++++++++ komorebi-recorder/src/analysis/flavor/mod.rs | 11 +- komorebi-recorder/src/analysis/ghost.rs | 3 + komorebi-recorder/src/annotations.rs | 4 + komorebi-recorder/src/asc/mod.rs | 4 +- komorebi-recorder/src/sources/komorebi_log.rs | 2 +- komorebi-recorder/tests/kde_flavor.rs | 144 ++++++ 8 files changed, 637 insertions(+), 4 deletions(-) create mode 100644 komorebi-recorder/src/analysis/flavor/kde.rs create mode 100644 komorebi-recorder/tests/kde_flavor.rs diff --git a/komorebi-recorder/src/analysis/catalog.rs b/komorebi-recorder/src/analysis/catalog.rs index 29a247b8..70b543b1 100644 --- a/komorebi-recorder/src/analysis/catalog.rs +++ b/komorebi-recorder/src/analysis/catalog.rs @@ -146,6 +146,7 @@ pub fn of(flavor: Flavor) -> &'static Catalog { match flavor { Flavor::Macos => &MAC, Flavor::Windows => &WINDOWS, + Flavor::Kde => &KDE, } } @@ -776,6 +777,7 @@ pub fn skew(flavor: Flavor, versions: &[KomorebiVersion], root: Option<&std::pat match flavor { Flavor::Macos => "KOMOREBI_MAC_SRC", Flavor::Windows => "KOMOREBI_WINDOWS_SRC", + Flavor::Kde => "KOMOREBI_KDE_SRC", } )); } diff --git a/komorebi-recorder/src/analysis/flavor/kde.rs b/komorebi-recorder/src/analysis/flavor/kde.rs new file mode 100644 index 00000000..3bbb56a9 --- /dev/null +++ b/komorebi-recorder/src/analysis/flavor/kde.rs @@ -0,0 +1,471 @@ +//! komorebi for KDE, as it describes itself. +//! +//! [`KdeRules`] is the [`Rules`] of [`Flavor::Kde`]. It keeps the defaults of +//! [`Rules::window_is_unreadable`] and answers `false` to [`Rules::verified`]: it was written from +//! komorebi for KDE's source, and has not been checked against a recording of it. What the rules +//! rely on: +//! +//! - A window event serializes as `{"type": "Show", "content": [{"type": "KWin", "content": +//! "WindowAdded"}, ]}`, where the first part is the compositor signal the bridge script +//! heard (`{"type": "Manual", ...}` is komorebi making one up) and the window is `{"id": ..., +//! "rect": ..., "details": {"title": ..., "exe": ..., "class": ..., "path": ...}}`. `Manage` and +//! `Unmanage` carry the window alone, and a `WorkspaceChange` carries a monitor id and a +//! workspace index in the place of the window. There is no process id. +//! - A monitor notification is a one-entry object (`{"Resize": 0}`, +//! `{"DisplayConnectionChange": 0}`), or the bare string `"Wake"`. +//! - A window in the `State` is known by its `id`, a number komorebi gave it (not KWin's UUID). +//! - The log has a header line for each handler, `processing event: for window with +//! notification ` inside a `handle_event` span, and `processing command: ` +//! inside a `process_command` span, where a command ends with `processed command: `. An +//! event's handler is timed by a debug line, `handled in