From 13c0e2faba9ea3f0381f1017c26f62830a6a2448 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 30 Oct 2026 23:07:49 -0700 Subject: [PATCH] refactor(themes): make the nine stackbar theme fields unconditional KomorebiThemeBase16, KomorebiThemeCatppuccin and KomorebiThemeCustom carried stackbar_focused_text, stackbar_unfocused_text and stackbar_background under cfg(target_os = "windows"), so what a Linux or macOS build accepted (and what its schema said) depended on the compile target: a Linux build could not even generate the Windows schema. komorebi-config needs one set of types, so the nine cfg attributes are removed. The KDE and macOS schemas keep their bytes because their views remove the fields again (changes.rs, applied after pruning); the Windows tree is unchanged. Consequences, all mechanical: the places in KDE and macOS that build a KomorebiThemeCustom, KomorebiThemeCatppuccin or ThemeOptions by name (workspace.rs in both, two KDE tests and a komorebi-client test) now say stackbar_*: None, which keeps what they meant. A KDE or macOS komorebi.json that sets one of the three keys in a theme is now accepted and ignored instead of ignored as an unknown key. The macOS bar's own schema (komorebi-for-mac/schema.bar.json) will gain the three fields when it is next generated; it cannot be regenerated on this host and is left for step 4b, whose per-platform view takes care of it. The oracle test now compares the Windows view too: all three views of StaticConfig are byte-identical to the checked-in schema.json files (Windows 141169, KDE 127164, macOS 120057 bytes). Verified: native cargo test -p komorebi-config: 4 unit + 8 schemas passed, 0 failed; Windows cargo clippy --workspace --locked --all-targets -D warnings clean; KDE cargo check --workspace --all-targets clean (after the wallpaper test fix), komorebic output byte-identical to schema.json and schema.asc.json; macOS fake-CC cargo check --workspace --all-targets: 0 errors. Not verified: macOS and Windows unit tests, schema.bar.json of either bar. --- komorebi-for-kde/komorebi-client/tests/subscribe.rs | 3 +++ komorebi-for-kde/komorebi/src/workspace.rs | 3 +++ komorebi-for-kde/komorebi/tests/themes.rs | 3 +++ komorebi-for-kde/komorebi/tests/wallpaper.rs | 3 +++ komorebi-for-mac/komorebi/src/workspace.rs | 3 +++ komorebi-themes/src/lib.rs | 9 --------- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/komorebi-for-kde/komorebi-client/tests/subscribe.rs b/komorebi-for-kde/komorebi-client/tests/subscribe.rs index 7c97376b..070055f2 100644 --- a/komorebi-for-kde/komorebi-client/tests/subscribe.rs +++ b/komorebi-for-kde/komorebi-client/tests/subscribe.rs @@ -277,6 +277,9 @@ fn a_subscriber_that_filters_state_changes_is_sent_a_theme() floating_border: None, unfocused_border: None, unfocused_locked_border: None, + stackbar_focused_text: None, + stackbar_unfocused_text: None, + stackbar_background: None, }); send_query(&SocketMessage::Theme(Box::new(theme)))?; diff --git a/komorebi-for-kde/komorebi/src/workspace.rs b/komorebi-for-kde/komorebi/src/workspace.rs index cb1dda4c..ca86b6e5 100644 --- a/komorebi-for-kde/komorebi/src/workspace.rs +++ b/komorebi-for-kde/komorebi/src/workspace.rs @@ -2155,6 +2155,9 @@ impl Workspace { unfocused_border: options.and_then(|o| o.unfocused_border), unfocused_locked_border: options.and_then(|o| o.unfocused_locked_border), bar_accent: options.and_then(|o| o.bar_accent), + stackbar_focused_text: None, + stackbar_unfocused_text: None, + stackbar_background: None, })); } } diff --git a/komorebi-for-kde/komorebi/tests/themes.rs b/komorebi-for-kde/komorebi/tests/themes.rs index bb31dafc..f05c3e4c 100644 --- a/komorebi-for-kde/komorebi/tests/themes.rs +++ b/komorebi-for-kde/komorebi/tests/themes.rs @@ -71,6 +71,9 @@ fn a_named_theme_colours_every_kind_of_border() { floating_border: None, unfocused_border: None, unfocused_locked_border: None, + stackbar_focused_text: None, + stackbar_unfocused_text: None, + stackbar_background: None, }, ))), ); diff --git a/komorebi-for-kde/komorebi/tests/wallpaper.rs b/komorebi-for-kde/komorebi/tests/wallpaper.rs index fcf915b0..06553c9d 100644 --- a/komorebi-for-kde/komorebi/tests/wallpaper.rs +++ b/komorebi-for-kde/komorebi/tests/wallpaper.rs @@ -355,6 +355,9 @@ fn theme_options_choose_the_variant_and_the_colour_each_border_takes() { unfocused_border: None, unfocused_locked_border: None, bar_accent: None, + stackbar_focused_text: None, + stackbar_unfocused_text: None, + stackbar_background: None, }; let by_default = focused_with(None); diff --git a/komorebi-for-mac/komorebi/src/workspace.rs b/komorebi-for-mac/komorebi/src/workspace.rs index 55dab6cf..042eb7b9 100644 --- a/komorebi-for-mac/komorebi/src/workspace.rs +++ b/komorebi-for-mac/komorebi/src/workspace.rs @@ -1647,6 +1647,9 @@ impl Workspace { .as_ref() .and_then(|o| o.unfocused_locked_border), bar_accent: wallpaper.theme_options.as_ref().and_then(|o| o.bar_accent), + stackbar_focused_text: None, + stackbar_unfocused_text: None, + stackbar_background: None, }); let bytes = SocketMessage::Theme(Box::new(komorebi_theme)).as_bytes()?; diff --git a/komorebi-themes/src/lib.rs b/komorebi-themes/src/lib.rs index ce3c278a..a0e509d9 100644 --- a/komorebi-themes/src/lib.rs +++ b/komorebi-themes/src/lib.rs @@ -460,17 +460,14 @@ pub struct KomorebiThemeCatppuccin { #[serde(skip_serializing_if = "Option::is_none")] #[cfg_attr(feature = "schemars", schemars(extend("default" = CatppuccinValue::Red)))] pub unfocused_locked_border: Option, - #[cfg(target_os = "windows")] /// Stackbar focused text colour #[serde(skip_serializing_if = "Option::is_none")] #[cfg_attr(feature = "schemars", schemars(extend("default" = CatppuccinValue::Green)))] pub stackbar_focused_text: Option, - #[cfg(target_os = "windows")] /// Stackbar unfocused text colour #[serde(skip_serializing_if = "Option::is_none")] #[cfg_attr(feature = "schemars", schemars(extend("default" = CatppuccinValue::Text)))] pub stackbar_unfocused_text: Option, - #[cfg(target_os = "windows")] /// Stackbar background colour #[serde(skip_serializing_if = "Option::is_none")] #[cfg_attr(feature = "schemars", schemars(extend("default" = CatppuccinValue::Base)))] @@ -511,17 +508,14 @@ pub struct KomorebiThemeBase16 { #[serde(skip_serializing_if = "Option::is_none")] #[cfg_attr(feature = "schemars", schemars(extend("default" = Base16Value::Base08)))] pub unfocused_locked_border: Option, - #[cfg(target_os = "windows")] /// Stackbar focused text colour #[serde(skip_serializing_if = "Option::is_none")] #[cfg_attr(feature = "schemars", schemars(extend("default" = Base16Value::Base0B)))] pub stackbar_focused_text: Option, - #[cfg(target_os = "windows")] /// Stackbar unfocused text colour #[serde(skip_serializing_if = "Option::is_none")] #[cfg_attr(feature = "schemars", schemars(extend("default" = Base16Value::Base05)))] pub stackbar_unfocused_text: Option, - #[cfg(target_os = "windows")] /// Stackbar background colour #[serde(skip_serializing_if = "Option::is_none")] #[cfg_attr(feature = "schemars", schemars(extend("default" = Base16Value::Base01)))] @@ -562,17 +556,14 @@ pub struct KomorebiThemeCustom { #[serde(skip_serializing_if = "Option::is_none")] #[cfg_attr(feature = "schemars", schemars(extend("default" = Base16Value::Base08)))] pub unfocused_locked_border: Option, - #[cfg(target_os = "windows")] /// Stackbar focused text colour #[serde(skip_serializing_if = "Option::is_none")] #[cfg_attr(feature = "schemars", schemars(extend("default" = Base16Value::Base0B)))] pub stackbar_focused_text: Option, - #[cfg(target_os = "windows")] /// Stackbar unfocused text colour #[serde(skip_serializing_if = "Option::is_none")] #[cfg_attr(feature = "schemars", schemars(extend("default" = Base16Value::Base05)))] pub stackbar_unfocused_text: Option, - #[cfg(target_os = "windows")] /// Stackbar background colour #[serde(skip_serializing_if = "Option::is_none")] #[cfg_attr(feature = "schemars", schemars(extend("default" = Base16Value::Base01)))]