From 3a287fcf0d316997b5862ba50268c1392bc39853 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sat, 31 Oct 2026 11:18:29 -0700 Subject: [PATCH] refactor(kde): take the default constants from komorebi-settings DEFAULT_RESIZE_DELTA, DEFAULT_MOUSE_FOLLOWS_FOCUS and the initial values of DEFAULT_WORKSPACE_PADDING and DEFAULT_CONTAINER_PADDING now come from komorebi_settings::shared (PlatformDefaults::KDE); the statics keep their names and types, so no reader changes. Adds the komorebi-settings path dependency (workspace and package manifest, Cargo.lock +1 package). Plan step 10, S1 (docs/dev/settings.md section 5). Pure refactor: same values (50, true, 5, 5), pinned by the crate's platform-defaults test. Verified: KDE cargo test -p komorebi --lib --tests (lite env, own target dir): all test binaries ok, 0 failed. KDE VM suites not run. --- komorebi-for-kde/Cargo.lock | 12 ++++++++++++ komorebi-for-kde/Cargo.toml | 1 + komorebi-for-kde/komorebi/Cargo.toml | 1 + komorebi-for-kde/komorebi/src/lib.rs | 10 ++++++---- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/komorebi-for-kde/Cargo.lock b/komorebi-for-kde/Cargo.lock index ff7cf3a5..9e7fb85c 100644 --- a/komorebi-for-kde/Cargo.lock +++ b/komorebi-for-kde/Cargo.lock @@ -2508,6 +2508,7 @@ dependencies = [ "komorebi-layouts", "komorebi-protocol", "komorebi-scrolling", + "komorebi-settings", "komorebi-themes", "komorebi-transport", "lazy_static", @@ -2612,6 +2613,17 @@ dependencies = [ name = "komorebi-scrolling" version = "0.1.42" +[[package]] +name = "komorebi-settings" +version = "0.1.42" +dependencies = [ + "komorebi-config", + "komorebi-layouts", + "komorebi-protocol", + "komorebi-themes", + "parking_lot 0.12.5", +] + [[package]] name = "komorebi-themes" version = "0.1.42" diff --git a/komorebi-for-kde/Cargo.toml b/komorebi-for-kde/Cargo.toml index 164f9ada..e31ce9e8 100644 --- a/komorebi-for-kde/Cargo.toml +++ b/komorebi-for-kde/Cargo.toml @@ -27,6 +27,7 @@ komorebi-layouts = { path = "../komorebi-layouts", features = [ komorebi-scrolling = { path = "../komorebi-scrolling" } # the wire types shared with the other komorebi daemons komorebi-config = { path = "../crates/komorebi-config", default-features = false, features = ["schemars"] } +komorebi-settings = { path = "../crates/komorebi-settings" } 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 diff --git a/komorebi-for-kde/komorebi/Cargo.toml b/komorebi-for-kde/komorebi/Cargo.toml index da974d14..9217a4d7 100644 --- a/komorebi-for-kde/komorebi/Cargo.toml +++ b/komorebi-for-kde/komorebi/Cargo.toml @@ -12,6 +12,7 @@ komorebi-collections = { workspace = true } komorebi-layouts = { workspace = true } komorebi-scrolling = { workspace = true } komorebi-config = { workspace = true } +komorebi-settings = { workspace = true } komorebi-protocol = { workspace = true } komorebi-transport = { workspace = true } version = { path = "../version" } diff --git a/komorebi-for-kde/komorebi/src/lib.rs b/komorebi-for-kde/komorebi/src/lib.rs index 58da817a..48b8f728 100644 --- a/komorebi-for-kde/komorebi/src/lib.rs +++ b/komorebi-for-kde/komorebi/src/lib.rs @@ -208,16 +208,18 @@ lazy_static! { /// The padding, in pixels, between the edge of a monitor's work area and the tiles of its /// workspaces, for a monitor that sets none of its own. The default for this is 5. -pub static DEFAULT_WORKSPACE_PADDING: AtomicI32 = AtomicI32::new(5); +pub static DEFAULT_WORKSPACE_PADDING: AtomicI32 = + AtomicI32::new(komorebi_settings::shared::PlatformDefaults::KDE.workspace_padding); /// The padding, in pixels, around each tile, for a monitor that sets none of its own. The default /// for this is 5. -pub static DEFAULT_CONTAINER_PADDING: AtomicI32 = AtomicI32::new(5); +pub static DEFAULT_CONTAINER_PADDING: AtomicI32 = + AtomicI32::new(komorebi_settings::shared::PlatformDefaults::KDE.container_padding); /// How many pixels `ResizeWindowEdge` and `ResizeWindowAxis` resize by, when `komorebi.json` does /// not say -pub static DEFAULT_RESIZE_DELTA: i32 = 50; +pub static DEFAULT_RESIZE_DELTA: i32 = komorebi_settings::shared::DEFAULT_RESIZE_DELTA; /// Whether the pointer goes to the window that is given the focus, when `komorebi.json` does not /// say -pub static DEFAULT_MOUSE_FOLLOWS_FOCUS: bool = true; +pub static DEFAULT_MOUSE_FOLLOWS_FOCUS: bool = komorebi_settings::shared::DEFAULT_MOUSE_FOLLOWS_FOCUS; /// The event, the message or the change of the monitors a [`Notification`] is about ///