From fe2febed56de6b4d811f37392637ec36a2c3841b Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sat, 31 Oct 2026 11:18:29 -0700 Subject: [PATCH] refactor(macos): 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::MACOS); the statics keep their names and types, so no reader changes. Adds the komorebi-settings path dependency (Cargo.lock +1 package). Plan step 10, S1. Pure refactor: same values (50, true, 5, 5). BORDER_OFFSET_ADJUSTMENT stays where it is: it is a macOS-only constant (the platform part, later). Verified: macOS fake-CC cargo check --target aarch64-apple-darwin --workspace --all-targets: 0 errors (type-check only; nothing linked or run; no Mac). --- komorebi-for-mac/Cargo.lock | 12 ++++++++++++ komorebi-for-mac/Cargo.toml | 1 + komorebi-for-mac/komorebi/Cargo.toml | 1 + komorebi-for-mac/komorebi/src/lib.rs | 10 ++++++---- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/komorebi-for-mac/Cargo.lock b/komorebi-for-mac/Cargo.lock index 2fc9e306..3d1d7170 100644 --- a/komorebi-for-mac/Cargo.lock +++ b/komorebi-for-mac/Cargo.lock @@ -3170,6 +3170,7 @@ dependencies = [ "komorebi-config", "komorebi-layouts", "komorebi-protocol", + "komorebi-settings", "komorebi-themes", "komorebi-transport", "lazy_static", @@ -3332,6 +3333,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", +] + [[package]] name = "komorebi-themes" version = "0.1.42" diff --git a/komorebi-for-mac/Cargo.toml b/komorebi-for-mac/Cargo.toml index a18ec567..325852c5 100644 --- a/komorebi-for-mac/Cargo.toml +++ b/komorebi-for-mac/Cargo.toml @@ -17,6 +17,7 @@ komorebi-themes = { path = "../komorebi-themes" } komorebi-backend = { path = "../crates/komorebi-backend" } komorebi-collections = { path = "../crates/komorebi-collections" } 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" } komorebi-layouts = { path = "../komorebi-layouts", features = [ diff --git a/komorebi-for-mac/komorebi/Cargo.toml b/komorebi-for-mac/komorebi/Cargo.toml index dfa9213a..2c47c276 100644 --- a/komorebi-for-mac/komorebi/Cargo.toml +++ b/komorebi-for-mac/komorebi/Cargo.toml @@ -10,6 +10,7 @@ komorebi-backend = { workspace = true } komorebi-collections = { workspace = true } komorebi-layouts = { workspace = true } komorebi-config = { workspace = true } +komorebi-settings = { 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" } diff --git a/komorebi-for-mac/komorebi/src/lib.rs b/komorebi-for-mac/komorebi/src/lib.rs index 55cf64de..a84784b5 100644 --- a/komorebi-for-mac/komorebi/src/lib.rs +++ b/komorebi-for-mac/komorebi/src/lib.rs @@ -159,10 +159,12 @@ lazy_static! { Arc::new(Mutex::new(HashMap::new())); } -pub static DEFAULT_WORKSPACE_PADDING: AtomicI32 = AtomicI32::new(5); -pub static DEFAULT_CONTAINER_PADDING: AtomicI32 = AtomicI32::new(5); -pub static DEFAULT_RESIZE_DELTA: i32 = 50; -pub static DEFAULT_MOUSE_FOLLOWS_FOCUS: bool = true; +pub static DEFAULT_WORKSPACE_PADDING: AtomicI32 = + AtomicI32::new(komorebi_settings::shared::PlatformDefaults::MACOS.workspace_padding); +pub static DEFAULT_CONTAINER_PADDING: AtomicI32 = + AtomicI32::new(komorebi_settings::shared::PlatformDefaults::MACOS.container_padding); +pub static DEFAULT_RESIZE_DELTA: i32 = komorebi_settings::shared::DEFAULT_RESIZE_DELTA; +pub static DEFAULT_MOUSE_FOLLOWS_FOCUS: bool = komorebi_settings::shared::DEFAULT_MOUSE_FOLLOWS_FOCUS; pub const PUBLIC_KEY: [u8; 32] = [ 0x5a, 0x69, 0x4a, 0xe1, 0x3c, 0x4b, 0xc8, 0x4e, 0xc3, 0x79, 0x0f, 0xab, 0x27, 0x6b, 0x7e, 0xdd,