build(transport): add the komorebi-transport crate with the pause filter

A new platform-neutral crate, crates/komorebi-transport (edition 2024, member of the root workspace), that will hold the command transport shared by the three daemons (D23/D24). It starts with allowed_while_paused(&SocketMessage) -> bool: the four messages (TogglePause, State, GlobalState, Stop) a daemon still handles while it is paused. It is a free function and not a method of the protocol enum because it is daemon policy, not wire format. Nothing calls it yet. A unit test lists the four and checks that other messages are refused.

Verified: cargo test -p komorebi-transport: 1 passed, 0 failed (native, tier 1). The tree gates run in the revisions that adopt it.
This commit is contained in:
LGUG2Z committed 2026-10-31 01:37:53 -07:00
1 parent dcadd9aa84
commit 9e39fcbbf4
5 files changed
+67

No files matched your search

Generated
+7
View File
@@ -3530,6 +3530,13 @@ dependencies = [
"strum",
]
[[package]]
name = "komorebi-transport"
version = "0.1.42"
dependencies = [
"komorebi-protocol",
]
[[package]]
name = "komorebic"
version = "0.1.42"
+1
View File
@@ -13,6 +13,7 @@ members = [
"komorebi-bar",
"komorebi-themes",
"crates/komorebi-protocol",
"crates/komorebi-transport",
"komorebi-shortcuts",
"e2e/guest/agent",
"e2e/guest/testwin",
+8
View File
@@ -0,0 +1,8 @@
[package]
name = "komorebi-transport"
version = "0.1.42"
description = "The command transport shared by every komorebi daemon: the pause filter, the command listener and the subscriber registry"
edition = "2024"
[dependencies]
komorebi-protocol = { path = "../komorebi-protocol", default-features = false }
+9
View File
@@ -0,0 +1,9 @@
//! The command transport shared by every komorebi daemon.
//!
//! The crate holds no window-manager code: the daemons plug their own window manager in through
//! small traits.
#![warn(clippy::all)]
mod pause;
pub use pause::allowed_while_paused;
+42
View File
@@ -0,0 +1,42 @@
use komorebi_protocol::message::SocketMessage;
/// Whether a daemon that is paused still handles `message`
///
/// Only `TogglePause` (to be able to resume), `State`, `GlobalState` and `Stop` are. This is
/// daemon policy and not part of the wire format, which is why it is a function here and not a
/// method of [`SocketMessage`].
#[must_use]
pub fn allowed_while_paused(message: &SocketMessage) -> bool {
matches!(
message,
SocketMessage::TogglePause
| SocketMessage::State
| SocketMessage::GlobalState
| SocketMessage::Stop
)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn only_the_four_messages_are_allowed_while_paused() {
for message in [
SocketMessage::TogglePause,
SocketMessage::State,
SocketMessage::GlobalState,
SocketMessage::Stop,
] {
assert!(allowed_while_paused(&message), "{message}");
}
for message in [
SocketMessage::Retile,
SocketMessage::UnmanageFocusedWindow,
SocketMessage::ReloadConfiguration,
] {
assert!(!allowed_while_paused(&message), "{message}");
}
}
}