refactor(mac): 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. Same behaviour: 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 macOS workspace.

Verified: macOS fake-CC cargo check --locked --target aarch64-apple-darwin --workspace --all-targets in komorebi-for-mac: 0 errors (warnings only, pre-existing). Unit tests cannot run on Linux.
This commit is contained in:
LGUG2Z committed 2026-10-31 01:37:53 -07:00
1 parent 42d78e887d
commit 587defe3c9
4 files changed
+16 -9

No files matched your search

+8
View File
@@ -3169,6 +3169,7 @@ dependencies = [
"komorebi-layouts",
"komorebi-protocol",
"komorebi-themes",
"komorebi-transport",
"lazy_static",
"nanoid",
"objc2 0.6.5",
@@ -3305,6 +3306,13 @@ dependencies = [
"strum",
]
[[package]]
name = "komorebi-transport"
version = "0.1.42"
dependencies = [
"komorebi-protocol",
]
[[package]]
name = "komorebic"
version = "0.1.1"
+1
View File
@@ -16,6 +16,7 @@ version = "0.1.0"
komorebi-themes = { path = "../komorebi-themes" }
komorebi-collections = { path = "../crates/komorebi-collections" }
komorebi-protocol = { path = "../crates/komorebi-protocol", default-features = false, features = ["schemars"] }
komorebi-transport = { path = "../crates/komorebi-transport" }
komorebi-layouts = { path = "../komorebi-layouts", features = [
"darwin",
"schemars",
+1
View File
@@ -9,6 +9,7 @@ komorebi-themes = { workspace = true }
komorebi-collections = { workspace = true }
komorebi-layouts = { workspace = true }
komorebi-protocol = { workspace = true }
komorebi-transport = { workspace = true }
quickxml_to_serde = { git = "https://github.com/LGUG2Z/quickxml_to_serde.git", version = "0.6.1" }
version = { path = "../version" }
@@ -59,6 +59,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 objc2_core_foundation::CFDictionary;
use parking_lot::Mutex;
use std::collections::HashMap;
@@ -1933,15 +1934,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(())
};
}