From 135324be89e4da3815eb89777dcffc8f057adc70 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Wed, 28 Oct 2026 22:17:46 -0700 Subject: [PATCH] feat(asc): a Kde platform, for which no rule is written yet --- komorebi-recorder/src/asc/mod.rs | 10 +++++++--- komorebi-recorder/src/asc/rule.rs | 7 +++++++ komorebi-recorder/src/asc/submit.rs | 15 +++++++++++---- komorebi-recorder/src/viewer/inspector.rs | 4 ++-- komorebi-recorder/src/viewer/rules.rs | 2 +- 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/komorebi-recorder/src/asc/mod.rs b/komorebi-recorder/src/asc/mod.rs index 435a8bd8..9502165e 100644 --- a/komorebi-recorder/src/asc/mod.rs +++ b/komorebi-recorder/src/asc/mod.rs @@ -32,6 +32,9 @@ pub enum Platform { /// komorebi for Mac: `applications.mac.json`. Programs are application names, and a window has /// no class. Macos, + /// komorebi for KDE. Its rules are in `komorebic/applications.json` of its own repository, and + /// nothing here writes or proposes one yet. Programs are application ids, as are classes. + Kde, } impl Platform { @@ -40,9 +43,8 @@ impl Platform { pub fn of(flavor: Flavor) -> Self { match flavor { Flavor::Windows => Self::Windows, - // komorebi for KDE has no rule file here yet, and no ghost tiles are found for it - // (see `Analysis::ghost_tiles`), so nothing asks for the platform of one - Flavor::Macos | Flavor::Kde => Self::Macos, + Flavor::Macos => Self::Macos, + Flavor::Kde => Self::Kde, } } @@ -52,6 +54,7 @@ impl Platform { match self { Self::Windows => "applications.json", Self::Macos => "applications.mac.json", + Self::Kde => "komorebic/applications.json", } } @@ -61,6 +64,7 @@ impl Platform { match self { Self::Windows => "komorebi for Windows", Self::Macos => "komorebi for Mac", + Self::Kde => "komorebi for KDE", } } } diff --git a/komorebi-recorder/src/asc/rule.rs b/komorebi-recorder/src/asc/rule.rs index b067843d..77b3f5ae 100644 --- a/komorebi-recorder/src/asc/rule.rs +++ b/komorebi-recorder/src/asc/rule.rs @@ -249,6 +249,13 @@ impl Rule { } identifiers.push(Identifier::title(&ghost.title)); } + Platform::Kde => { + return Err(NoRule( + "the rules of komorebi for KDE are in its own repository, and a rule for it is \ + not written here yet" + .to_string(), + )); + } } Ok(Self::ignore(&app_name(&ghost.exe), identifiers)) diff --git a/komorebi-recorder/src/asc/submit.rs b/komorebi-recorder/src/asc/submit.rs index f0110f0b..6728011d 100644 --- a/komorebi-recorder/src/asc/submit.rs +++ b/komorebi-recorder/src/asc/submit.rs @@ -165,7 +165,7 @@ impl Proposal { class = ghost.class, titled = quoted_title(&ghost.title), ), - Platform::Macos => format!( + Platform::Macos | Platform::Kde => format!( "window {hwnd} of `{exe}` ({titled})", hwnd = ghost.hwnd, exe = ghost.exe, @@ -185,14 +185,21 @@ impl Proposal { whether a window is drawn, so this is the frame komorebi had for it)", how = ghost.hidden_how ), + Platform::Kde => format!( + "in every one of those states the frame of the window, as KWin reports it, was {how}, \ + and it was never a frame a person could see. (this is the frame komorebi had for \ + the window, and not KWin saying that the window is not drawn)", + how = ghost.hidden_how + ), }; let recorded_with = match platform { Platform::Windows => "with window probes on (komorebi-recorder's default on Windows)", Platform::Macos => "of komorebi for Mac", + Platform::Kde => "of komorebi for KDE", }; let reads = match platform { Platform::Windows => "read the state of", - Platform::Macos => "recorded the state of", + Platform::Macos | Platform::Kde => "recorded the state of", }; let others = if ghost.siblings.is_empty() { format!( @@ -210,7 +217,7 @@ impl Proposal { sibling.class, quoted_title(&sibling.title) ), - Platform::Macos => quoted_title(&sibling.title), + Platform::Macos | Platform::Kde => quoted_title(&sibling.title), }) .collect(); seen.sort(); @@ -234,7 +241,7 @@ impl Proposal { "the program **and** the class" } } - Platform::Macos => "the application **and** the title", + Platform::Macos | Platform::Kde => "the application **and** the title", }; let body = format!( "Ignore {what}: {komorebi} gives it a tile that a person can never see.\n\ diff --git a/komorebi-recorder/src/viewer/inspector.rs b/komorebi-recorder/src/viewer/inspector.rs index 85407514..7d21be03 100644 --- a/komorebi-recorder/src/viewer/inspector.rs +++ b/komorebi-recorder/src/viewer/inspector.rs @@ -68,8 +68,8 @@ fn chip(ui: &mut egui::Ui, text: &str, colour: Color32) { fn ghost_name(ghost: &GhostTile) -> String { match ghost.platform { Platform::Windows => format!("{} ({})", ghost.exe, ghost.class), - Platform::Macos if ghost.title.is_empty() => ghost.exe.clone(), - Platform::Macos => format!("{} ({:?})", ghost.exe, ghost.title), + Platform::Macos | Platform::Kde if ghost.title.is_empty() => ghost.exe.clone(), + Platform::Macos | Platform::Kde => format!("{} ({:?})", ghost.exe, ghost.title), } } diff --git a/komorebi-recorder/src/viewer/rules.rs b/komorebi-recorder/src/viewer/rules.rs index 3ed9eb15..b86dfc36 100644 --- a/komorebi-recorder/src/viewer/rules.rs +++ b/komorebi-recorder/src/viewer/rules.rs @@ -308,7 +308,7 @@ fn what_was_seen(ghost: &GhostTile) -> String { window exists.", ghost.exe, ghost.class, ghost.reads, ghost.hidden_how, ), - Platform::Macos => format!( + Platform::Macos | Platform::Kde => format!( "komorebi gave `{}` ({}) a tile, and on {} reads between {from} and {to} the frame it \ had for the window was {}, never one a person could see. The tile is empty for as long \ as the window exists.",