From 42d78e887de88d2bc75c66f1690cccd852c84f63 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 30 Oct 2026 22:03:08 -0700 Subject: [PATCH] refactor(kde): use the shared pause filter read_commands_uds now asks komorebi_transport::allowed_while_paused instead of listing TogglePause, State, GlobalState and Stop in a match. The behaviour is the same: while paused those four are handled, any other message is dropped with the same trace log, and the connection ends after either. komorebi-transport is added as a path dependency of the KDE workspace. Verified: cargo check -p komorebi --all-targets in komorebi-for-kde: no errors; cargo test -p komorebi --lib process_command: 11 passed, 0 failed (includes while_paused_only_toggle_pause_state_and_stop_are_handled). Full workspace run is done once at the end of the KDE listener stage. --- komorebi-for-kde/Cargo.lock | 8 ++++++++ komorebi-for-kde/Cargo.toml | 1 + komorebi-for-kde/komorebi/Cargo.toml | 1 + komorebi-for-kde/komorebi/src/process_command.rs | 15 ++++++--------- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/komorebi-for-kde/Cargo.lock b/komorebi-for-kde/Cargo.lock index 7d2365fb..32e38f4a 100644 --- a/komorebi-for-kde/Cargo.lock +++ b/komorebi-for-kde/Cargo.lock @@ -2507,6 +2507,7 @@ dependencies = [ "komorebi-protocol", "komorebi-scrolling", "komorebi-themes", + "komorebi-transport", "lazy_static", "nanoid", "parking_lot 0.13.0", @@ -2601,6 +2602,13 @@ dependencies = [ "strum", ] +[[package]] +name = "komorebi-transport" +version = "0.1.42" +dependencies = [ + "komorebi-protocol", +] + [[package]] name = "komorebic" version = "0.1.0" diff --git a/komorebi-for-kde/Cargo.toml b/komorebi-for-kde/Cargo.toml index 1df4af7c..7a8be711 100644 --- a/komorebi-for-kde/Cargo.toml +++ b/komorebi-for-kde/Cargo.toml @@ -25,6 +25,7 @@ komorebi-layouts = { path = "../komorebi-layouts", features = [ komorebi-scrolling = { path = "../komorebi-scrolling" } # the wire types shared with the other komorebi daemons komorebi-protocol = { path = "../crates/komorebi-protocol", default-features = false, features = ["schemars"] } +komorebi-transport = { path = "../crates/komorebi-transport" } # the themes (and the palettes made from pictures), from the same upstream revision komorebi-themes = { path = "../komorebi-themes" } diff --git a/komorebi-for-kde/komorebi/Cargo.toml b/komorebi-for-kde/komorebi/Cargo.toml index 87e00f8a..a614d10b 100644 --- a/komorebi-for-kde/komorebi/Cargo.toml +++ b/komorebi-for-kde/komorebi/Cargo.toml @@ -11,6 +11,7 @@ komorebi-collections = { workspace = true } komorebi-layouts = { workspace = true } komorebi-scrolling = { workspace = true } komorebi-protocol = { workspace = true } +komorebi-transport = { workspace = true } version = { path = "../version" } clap = { workspace = true } diff --git a/komorebi-for-kde/komorebi/src/process_command.rs b/komorebi-for-kde/komorebi/src/process_command.rs index 3c8a3a30..d54917ee 100644 --- a/komorebi-for-kde/komorebi/src/process_command.rs +++ b/komorebi-for-kde/komorebi/src/process_command.rs @@ -272,6 +272,7 @@ use color_eyre::eyre; use color_eyre::eyre::Context; use color_eyre::eyre::OptionExt; use komorebi_themes::colour::Rgb; +use komorebi_transport::allowed_while_paused; use parking_lot::Mutex; use std::collections::HashMap; use std::fs::File; @@ -2172,15 +2173,11 @@ pub fn read_commands_uds( } Some(mut wm) => { if wm.is_paused { - return match message { - SocketMessage::TogglePause - | SocketMessage::State - | SocketMessage::GlobalState - | SocketMessage::Stop => Ok(wm.process_command(message, &mut stream)?), - _ => { - tracing::trace!("ignoring while paused"); - Ok(()) - } + return if allowed_while_paused(&message) { + Ok(wm.process_command(message, &mut stream)?) + } else { + tracing::trace!("ignoring while paused"); + Ok(()) }; }