refactor(windows): use the shared pause filter

Both read_commands_uds and read_commands_tcp now ask komorebi_transport::allowed_while_paused instead of listing TogglePause, State, GlobalState and Stop. The one token that differed between the two copies (process_command(message, stream) in the TCP reader, where stream is already a &mut TcpStream, against &mut stream in the UDS reader) is only how the reply stream is passed: each call site keeps its own form, so TCP behaviour is unchanged. A paused connection still ends after the first message. komorebi-transport becomes a dependency of the Windows daemon.

Verified: nix develop --command cargo clippy --workspace --locked --all-targets -- -D warnings: finished, no warnings or errors (tier 2). Not run: Windows unit tests or scenarios.
This commit is contained in:
LGUG2Z committed 2026-10-31 01:37:53 -07:00
1 parent 587defe3c9
commit baeb64de55
3 files changed
+13 -18

No files matched your search

Generated
+1
View File
@@ -3342,6 +3342,7 @@ dependencies = [
"komorebi-protocol",
"komorebi-scrolling",
"komorebi-themes",
"komorebi-transport",
"lazy_static",
"miow",
"nanoid",
+1
View File
@@ -13,6 +13,7 @@ komorebi-layouts = { path = "../komorebi-layouts", features = ["win32"] }
komorebi-scrolling = { path = "../komorebi-scrolling" }
komorebi-themes = { path = "../komorebi-themes" }
komorebi-protocol = { path = "../crates/komorebi-protocol", default-features = false }
komorebi-transport = { path = "../crates/komorebi-transport" }
base64 = "0.22"
bitflags = { version = "2", features = ["serde"] }
+11 -18
View File
@@ -2,6 +2,7 @@ use color_eyre::eyre;
use color_eyre::eyre::OptionExt;
use color_eyre::eyre::WrapErr;
use komorebi_themes::colour::Rgb;
use komorebi_transport::allowed_while_paused;
use miow::pipe::connect;
use parking_lot::Mutex;
use std::collections::HashMap;
@@ -2291,15 +2292,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(())
};
}
@@ -2339,15 +2336,11 @@ pub fn read_commands_tcp(
let mut wm = wm.lock();
if wm.is_paused {
return match message {
SocketMessage::TogglePause
| SocketMessage::State
| SocketMessage::GlobalState
| SocketMessage::Stop => Ok(wm.process_command(message, stream)?),
_ => {
tracing::trace!("ignoring while paused");
Ok(())
}
return if allowed_while_paused(&message) {
Ok(wm.process_command(message, stream)?)
} else {
tracing::trace!("ignoring while paused");
Ok(())
};
}