mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-16 13:51:19 +01:00
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.
This commit is contained in:
1 parent
9e39fcbbf4
commit
42d78e887d
4 files changed
+16
-9
No files matched your search
Generated
+8
@@ -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"
|
||||
|
||||
@@ -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" }
|
||||
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -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(())
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user