From 27454c31861dae417923a64e897c2b38c4aa7c1d Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sat, 27 Dec 2025 22:24:05 -0800 Subject: [PATCH] refactor(config): pull theme structs from komorebi-themes Centralized both KomorebiTheme and KomobarTheme in the komorebi-themes module in komorebi for Windows. This commit removes the duplicated references in komorebi for Mac and just pulls in those; now we only have to update the docs in one place. Regenerated all the schemas after pulling in the changes. --- Cargo.lock | 2 +- Cargo.toml | 2 +- komorebi-bar/src/bar.rs | 17 +- komorebi-bar/src/config.rs | 69 +--- komorebi-client/src/lib.rs | 2 +- komorebi/src/core/mod.rs | 2 +- komorebi/src/static_config.rs | 137 +------- komorebi/src/theme_manager.rs | 74 +---- komorebi/src/workspace.rs | 19 +- nix/komorebi-bar-options.nix | 67 ++-- nix/komorebi-options.nix | 48 +-- schema.bar.json | 263 ++++++++------- schema.json | 581 ++++++++++++++++++---------------- 13 files changed, 551 insertions(+), 732 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 71a6ef21..e323d2b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3091,7 +3091,7 @@ dependencies = [ [[package]] name = "komorebi-themes" version = "0.1.40" -source = "git+https://github.com/LGUG2Z/komorebi?rev=3a81f7babbb95f594f4d02ba16ea406ab83b1133#3a81f7babbb95f594f4d02ba16ea406ab83b1133" +source = "git+https://github.com/LGUG2Z/komorebi?rev=0758c7d9008a8e174ac35f469e53fd8fddd6b672#0758c7d9008a8e174ac35f469e53fd8fddd6b672" dependencies = [ "base16-egui-themes", "catppuccin-egui", diff --git a/Cargo.toml b/Cargo.toml index a0de4ddc..eece35e2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ members = [ version = "0.1.0" [workspace.dependencies] -komorebi-themes = { git = "https://github.com/LGUG2Z/komorebi", rev = "3a81f7babbb95f594f4d02ba16ea406ab83b1133" } +komorebi-themes = { git = "https://github.com/LGUG2Z/komorebi", rev = "0758c7d9008a8e174ac35f469e53fd8fddd6b672" } chrono = "0.4" chrono-tz = "0.10" diff --git a/komorebi-bar/src/bar.rs b/komorebi-bar/src/bar.rs index a5649755..4a1e1f21 100644 --- a/komorebi-bar/src/bar.rs +++ b/komorebi-bar/src/bar.rs @@ -8,7 +8,6 @@ use crate::MONITOR_LEFT; use crate::MONITOR_RIGHT; use crate::MONITOR_TOP; use crate::config::KomobarConfig; -use crate::config::KomobarTheme; use crate::config::MonitorConfigOrIndex; use crate::config::Position; use crate::config::PositionConfig; @@ -52,6 +51,10 @@ use komorebi_client::PathExt; use komorebi_client::SocketMessage; use komorebi_themes::Base16Wrapper; use komorebi_themes::Catppuccin; +use komorebi_themes::KomobarTheme; +use komorebi_themes::KomobarThemeBase16; +use komorebi_themes::KomobarThemeCatppuccin; +use komorebi_themes::KomobarThemeCustom; use komorebi_themes::catppuccin_egui; use lazy_static::lazy_static; use parking_lot::Mutex; @@ -174,12 +177,12 @@ pub fn apply_theme( render_config: Rc>, ) { let (auto_select_fill, auto_select_text) = match theme { - KomobarTheme::Catppuccin { + KomobarTheme::Catppuccin(KomobarThemeCatppuccin { name: catppuccin, accent: catppuccin_value, auto_select_fill: catppuccin_auto_select_fill, auto_select_text: catppuccin_auto_select_text, - } => { + }) => { match catppuccin { Catppuccin::Frappe => { catppuccin_egui::set_theme(ctx, catppuccin_egui::FRAPPE); @@ -244,12 +247,12 @@ pub fn apply_theme( catppuccin_auto_select_text.map(|c| c.color32(catppuccin.as_theme())), ) } - KomobarTheme::Base16 { + KomobarTheme::Base16(KomobarThemeBase16 { name: base16, accent: base16_value, auto_select_fill: base16_auto_select_fill, auto_select_text: base16_auto_select_text, - } => { + }) => { ctx.set_style(base16.style()); let base16_value = base16_value.unwrap_or_default(); let accent = base16_value.color32(Base16Wrapper::Base16(base16)); @@ -267,12 +270,12 @@ pub fn apply_theme( base16_auto_select_text.map(|c| c.color32(Base16Wrapper::Base16(base16))), ) } - KomobarTheme::Custom { + KomobarTheme::Custom(KomobarThemeCustom { colours, accent: base16_value, auto_select_fill: base16_auto_select_fill, auto_select_text: base16_auto_select_text, - } => { + }) => { let background = colours.background(); ctx.set_style(colours.style()); let base16_value = base16_value.unwrap_or_default(); diff --git a/komorebi-bar/src/config.rs b/komorebi-bar/src/config.rs index c4687ed9..015995eb 100644 --- a/komorebi-bar/src/config.rs +++ b/komorebi-bar/src/config.rs @@ -6,8 +6,8 @@ use color_eyre::eyre; use eframe::egui::Pos2; use eframe::egui::TextBuffer; use eframe::egui::Vec2; -use komorebi_client::KomorebiTheme; use komorebi_client::Rect; +use komorebi_themes::KomobarTheme; use serde::Deserialize; use serde::Serialize; use std::collections::HashMap; @@ -554,73 +554,6 @@ impl From for Pos2 { } } -#[derive(Clone, Debug, Serialize, Deserialize)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[serde(tag = "palette")] -/// Komorebi bar theme -pub enum KomobarTheme { - /// Theme from catppuccin-egui - #[cfg_attr(feature = "schemars", schemars(title = "Catppuccin"))] - Catppuccin { - /// Name of the Catppuccin theme (theme previews: https://github.com/catppuccin/catppuccin) - name: komorebi_themes::Catppuccin, - accent: Option, - auto_select_fill: Option, - auto_select_text: Option, - }, - /// Theme from base16-egui-themes - #[cfg_attr(feature = "schemars", schemars(title = "Base16"))] - Base16 { - /// Name of the Base16 theme (theme previews: https://tinted-theming.github.io/tinted-gallery/) - name: komorebi_themes::Base16, - accent: Option, - auto_select_fill: Option, - auto_select_text: Option, - }, - /// Custom Base16 theme - #[cfg_attr(feature = "schemars", schemars(title = "Custom"))] - Custom { - /// Colours of the custom Base16 theme palette - colours: Box, - accent: Option, - auto_select_fill: Option, - auto_select_text: Option, - }, -} - -impl From for KomobarTheme { - fn from(value: KomorebiTheme) -> Self { - match value { - KomorebiTheme::Catppuccin { - name, bar_accent, .. - } => Self::Catppuccin { - name, - accent: bar_accent, - auto_select_fill: None, - auto_select_text: None, - }, - KomorebiTheme::Base16 { - name, bar_accent, .. - } => Self::Base16 { - name, - accent: bar_accent, - auto_select_fill: None, - auto_select_text: None, - }, - KomorebiTheme::Custom { - colours, - bar_accent, - .. - } => Self::Custom { - colours, - accent: bar_accent, - auto_select_fill: None, - auto_select_text: None, - }, - } - } -} - #[derive(Copy, Clone, Debug, Serialize, Deserialize)] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] /// Label prefix diff --git a/komorebi-client/src/lib.rs b/komorebi-client/src/lib.rs index 859a479e..653d4814 100644 --- a/komorebi-client/src/lib.rs +++ b/komorebi-client/src/lib.rs @@ -24,11 +24,11 @@ pub use komorebi::core::rect::Rect; pub use komorebi::monitor_reconciliator::MonitorNotification; pub use komorebi::splash; pub use komorebi::state::State; -pub use komorebi::static_config::KomorebiTheme; pub use komorebi::static_config::StaticConfig; pub use komorebi::window::Window; pub use komorebi::workspace::Workspace; pub use komorebi::workspace::WorkspaceLayer; +pub use komorebi_themes::KomorebiTheme; pub use komorebi_themes::colour::Colour; pub use komorebi_themes::colour::Rgb; use std::borrow::Borrow; diff --git a/komorebi/src/core/mod.rs b/komorebi/src/core/mod.rs index 23fa0c29..83facad3 100644 --- a/komorebi/src/core/mod.rs +++ b/komorebi/src/core/mod.rs @@ -6,9 +6,9 @@ use crate::core::default_layout::DefaultLayout; use crate::core::operation_direction::OperationDirection; use crate::core::pathext::ResolvedPathBuf; use crate::core::rect::Rect; -use crate::static_config::KomorebiTheme; use clap::ValueEnum; use color_eyre::eyre; +use komorebi_themes::KomorebiTheme; use serde::Deserialize; use serde::Serialize; use std::num::NonZeroUsize; diff --git a/komorebi/src/static_config.rs b/komorebi/src/static_config.rs index b9f502b4..a67c32ed 100644 --- a/komorebi/src/static_config.rs +++ b/komorebi/src/static_config.rs @@ -55,6 +55,7 @@ use color_eyre::eyre; use crossbeam_channel::Receiver; use hotwatch::EventKind; use hotwatch::Hotwatch; +use komorebi_themes::KomorebiTheme; use komorebi_themes::colour::Colour; use objc2_core_foundation::CFRetained; use objc2_core_foundation::CFRunLoop; @@ -623,142 +624,6 @@ pub struct AnimationsConfig { pub fps: Option, } -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[serde(tag = "palette")] -/// Komorebi theme -pub enum KomorebiTheme { - /// A theme from catppuccin-egui - #[cfg_attr(feature = "schemars", schemars(title = "Catppuccin"))] - Catppuccin { - /// Name of the Catppuccin theme (theme previews: https://github.com/catppuccin/catppuccin) - name: komorebi_themes::Catppuccin, - /// Border colour when the container contains a single window - #[serde(skip_serializing_if = "Option::is_none")] - #[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::CatppuccinValue::Blue)))] - single_border: Option, - /// Border colour when the container contains multiple windows - #[serde(skip_serializing_if = "Option::is_none")] - #[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::CatppuccinValue::Green)))] - stack_border: Option, - /// Border colour when the container is in monocle mode - #[serde(skip_serializing_if = "Option::is_none")] - #[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::CatppuccinValue::Pink)))] - monocle_border: Option, - /// Border colour when the window is floating - #[serde(skip_serializing_if = "Option::is_none")] - #[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::CatppuccinValue::Yellow)))] - floating_border: Option, - /// Border colour when the container is unfocused - #[serde(skip_serializing_if = "Option::is_none")] - #[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::CatppuccinValue::Base)))] - unfocused_border: Option, - /// Border colour when the container is unfocused and locked - #[serde(skip_serializing_if = "Option::is_none")] - #[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::CatppuccinValue::Red)))] - unfocused_locked_border: Option, - // /// Stackbar focused tab text colour (default: Green) - // #[serde(skip_serializing_if = "Option::is_none")] - // stackbar_focused_text: Option, - // /// Stackbar unfocused tab text colour (default: Text) - // #[serde(skip_serializing_if = "Option::is_none")] - // stackbar_unfocused_text: Option, - // /// Stackbar tab background colour (default: Base) - // #[serde(skip_serializing_if = "Option::is_none")] - // stackbar_background: Option, - /// Komorebi status bar accent - #[serde(skip_serializing_if = "Option::is_none")] - #[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::CatppuccinValue::Blue)))] - bar_accent: Option, - }, - /// A theme from base16-egui-themes - #[cfg_attr(feature = "schemars", schemars(title = "Base16"))] - Base16 { - /// Name of the Base16 theme (theme previews: https://tinted-theming.github.io/tinted-gallery/) - name: komorebi_themes::Base16, - /// Border colour when the container contains a single window - #[serde(skip_serializing_if = "Option::is_none")] - #[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0D)))] - single_border: Option, - /// Border colour when the container contains multiple windows - #[serde(skip_serializing_if = "Option::is_none")] - #[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0B)))] - stack_border: Option, - /// Border colour when the container is in monocle mode - #[serde(skip_serializing_if = "Option::is_none")] - #[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0F)))] - monocle_border: Option, - /// Border colour when the window is floating - #[serde(skip_serializing_if = "Option::is_none")] - #[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base09)))] - floating_border: Option, - /// Border colour when the container is unfocused - #[serde(skip_serializing_if = "Option::is_none")] - #[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base01)))] - unfocused_border: Option, - /// Border colour when the container is unfocused and locked - #[serde(skip_serializing_if = "Option::is_none")] - #[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base08)))] - unfocused_locked_border: Option, - // /// Stackbar focused tab text colour (default: Base0B) - // #[serde(skip_serializing_if = "Option::is_none")] - // stackbar_focused_text: Option, - // /// Stackbar unfocused tab text colour (default: Base05) - // #[serde(skip_serializing_if = "Option::is_none")] - // stackbar_unfocused_text: Option, - // /// Stackbar tab background colour (default: Base01) - // #[serde(skip_serializing_if = "Option::is_none")] - // stackbar_background: Option, - /// Komorebi status bar accent - #[serde(skip_serializing_if = "Option::is_none")] - #[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0D)))] - bar_accent: Option, - }, - /// A custom Base16 theme - #[cfg_attr(feature = "schemars", schemars(title = "Custom"))] - Custom { - /// Colours of the custom Base16 theme palette - colours: Box, - /// Border colour when the container contains a single window - #[serde(skip_serializing_if = "Option::is_none")] - #[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0D)))] - single_border: Option, - /// Border colour when the container contains multiple windows - #[serde(skip_serializing_if = "Option::is_none")] - #[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0B)))] - stack_border: Option, - /// Border colour when the container is in monocle mode - #[serde(skip_serializing_if = "Option::is_none")] - #[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0F)))] - monocle_border: Option, - /// Border colour when the window is floating - #[serde(skip_serializing_if = "Option::is_none")] - #[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base09)))] - floating_border: Option, - /// Border colour when the container is unfocused - #[serde(skip_serializing_if = "Option::is_none")] - #[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base01)))] - unfocused_border: Option, - /// Border colour when the container is unfocused and locked - #[serde(skip_serializing_if = "Option::is_none")] - #[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base08)))] - unfocused_locked_border: Option, - // /// Stackbar focused tab text colour (default: Base0B) - // #[serde(skip_serializing_if = "Option::is_none")] - // stackbar_focused_text: Option, - // /// Stackbar unfocused tab text colour (default: Base05) - // #[serde(skip_serializing_if = "Option::is_none")] - // stackbar_unfocused_text: Option, - // /// Stackbar tab background colour (default: Base01) - // #[serde(skip_serializing_if = "Option::is_none")] - // stackbar_background: Option, - /// Komorebi status bar accent - #[serde(skip_serializing_if = "Option::is_none")] - #[cfg_attr(feature = "schemars", schemars(extend("default" = komorebi_themes::Base16Value::Base0D)))] - bar_accent: Option, - }, -} - // #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] // #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] // pub struct TabsConfig { diff --git a/komorebi/src/theme_manager.rs b/komorebi/src/theme_manager.rs index fdca3473..f3ff63e1 100644 --- a/komorebi/src/theme_manager.rs +++ b/komorebi/src/theme_manager.rs @@ -1,11 +1,14 @@ #![deny(clippy::unwrap_used, clippy::expect_used)] use crate::border_manager; -use crate::static_config::KomorebiTheme; use crossbeam_channel::Receiver; use crossbeam_channel::Sender; use crossbeam_utils::atomic::AtomicCell; use komorebi_themes::Base16Wrapper; +use komorebi_themes::KomorebiTheme; +use komorebi_themes::KomorebiThemeBase16; +use komorebi_themes::KomorebiThemeCatppuccin; +use komorebi_themes::KomorebiThemeCustom; use komorebi_themes::colour::Colour; use std::ops::Deref; use std::sync::OnceLock; @@ -76,11 +79,8 @@ pub fn handle_notifications() -> color_eyre::Result<()> { floating_border, unfocused_border, unfocused_locked_border, - // _stackbar_focused_text, - // _stackbar_unfocused_text, - // _stackbar_background, ) = match theme { - KomorebiTheme::Catppuccin { + KomorebiTheme::Catppuccin(KomorebiThemeCatppuccin { name, single_border, stack_border, @@ -88,11 +88,8 @@ pub fn handle_notifications() -> color_eyre::Result<()> { floating_border, unfocused_border, unfocused_locked_border, - // stackbar_focused_text, - // stackbar_unfocused_text, - // stackbar_background, .. - } => { + }) => { let single_border = single_border .unwrap_or(komorebi_themes::CatppuccinValue::Blue) .color32(name.as_theme()); @@ -117,18 +114,6 @@ pub fn handle_notifications() -> color_eyre::Result<()> { .unwrap_or(komorebi_themes::CatppuccinValue::Red) .color32(name.as_theme()); - // let stackbar_focused_text = stackbar_focused_text - // .unwrap_or(komorebi_themes::CatppuccinValue::Green) - // .color32(name.as_theme()); - - // let stackbar_unfocused_text = stackbar_unfocused_text - // .unwrap_or(komorebi_themes::CatppuccinValue::Text) - // .color32(name.as_theme()); - - // let stackbar_background = stackbar_background - // .unwrap_or(komorebi_themes::CatppuccinValue::Base) - // .color32(name.as_theme()); - ( single_border, stack_border, @@ -136,12 +121,9 @@ pub fn handle_notifications() -> color_eyre::Result<()> { floating_border, unfocused_border, unfocused_locked_border, - // stackbar_focused_text, - // stackbar_unfocused_text, - // stackbar_background, ) } - KomorebiTheme::Base16 { + KomorebiTheme::Base16(KomorebiThemeBase16 { name, single_border, stack_border, @@ -149,11 +131,8 @@ pub fn handle_notifications() -> color_eyre::Result<()> { floating_border, unfocused_border, unfocused_locked_border, - // stackbar_focused_text, - // stackbar_unfocused_text, - // stackbar_background, .. - } => { + }) => { let single_border = single_border .unwrap_or(komorebi_themes::Base16Value::Base0D) .color32(Base16Wrapper::Base16(*name)); @@ -178,18 +157,6 @@ pub fn handle_notifications() -> color_eyre::Result<()> { .unwrap_or(komorebi_themes::Base16Value::Base09) .color32(Base16Wrapper::Base16(*name)); - // let stackbar_focused_text = stackbar_focused_text - // .unwrap_or(komorebi_themes::Base16Value::Base0B) - // .color32(Base16Wrapper::Base16(*name)); - - // let stackbar_unfocused_text = stackbar_unfocused_text - // .unwrap_or(komorebi_themes::Base16Value::Base05) - // .color32(Base16Wrapper::Base16(*name)); - - // let stackbar_background = stackbar_background - // .unwrap_or(komorebi_themes::Base16Value::Base01) - // .color32(Base16Wrapper::Base16(*name)); - ( single_border, stack_border, @@ -197,12 +164,9 @@ pub fn handle_notifications() -> color_eyre::Result<()> { floating_border, unfocused_border, unfocused_locked_border, - // stackbar_focused_text, - // stackbar_unfocused_text, - // stackbar_background, ) } - KomorebiTheme::Custom { + KomorebiTheme::Custom(KomorebiThemeCustom { colours, single_border, stack_border, @@ -210,11 +174,8 @@ pub fn handle_notifications() -> color_eyre::Result<()> { floating_border, unfocused_border, unfocused_locked_border, - // stackbar_focused_text, - // stackbar_unfocused_text, - // stackbar_background, .. - } => { + }) => { let single_border = single_border .unwrap_or(komorebi_themes::Base16Value::Base0D) .color32(Base16Wrapper::Custom(colours.clone())); @@ -239,18 +200,6 @@ pub fn handle_notifications() -> color_eyre::Result<()> { .unwrap_or(komorebi_themes::Base16Value::Base09) .color32(Base16Wrapper::Custom(colours.clone())); - // let stackbar_focused_text = stackbar_focused_text - // .unwrap_or(komorebi_themes::Base16Value::Base0B) - // .color32(Base16Wrapper::Custom(colours.clone())); - - // let stackbar_unfocused_text = stackbar_unfocused_text - // .unwrap_or(komorebi_themes::Base16Value::Base05) - // .color32(Base16Wrapper::Custom(colours.clone())); - - // let stackbar_background = stackbar_background - // .unwrap_or(komorebi_themes::Base16Value::Base01) - // .color32(Base16Wrapper::Custom(colours.clone())); - ( single_border, stack_border, @@ -258,9 +207,6 @@ pub fn handle_notifications() -> color_eyre::Result<()> { floating_border, unfocused_border, unfocused_locked_border, - // stackbar_focused_text, - // stackbar_unfocused_text, - // stackbar_background, ) } }; diff --git a/komorebi/src/workspace.rs b/komorebi/src/workspace.rs index 2d0e8d21..b6b490d0 100644 --- a/komorebi/src/workspace.rs +++ b/komorebi/src/workspace.rs @@ -17,7 +17,6 @@ use crate::ring::Ring; use crate::skylight::CGSMainConnectionID; use crate::skylight::SLSDisableUpdate; use crate::skylight::SLSReenableUpdate; -use crate::static_config::KomorebiTheme; use crate::static_config::Wallpaper; use crate::static_config::WorkspaceConfig; use crate::window::Window; @@ -25,6 +24,8 @@ use crate::window::WindowDetails; use color_eyre::eyre; use color_eyre::eyre::OptionExt; use komorebi_themes::Base16ColourPalette; +use komorebi_themes::KomorebiTheme; +use komorebi_themes::KomorebiThemeCustom; use serde::Deserialize; use serde::Serialize; use std::collections::HashMap; @@ -1358,7 +1359,7 @@ impl Workspace { } if let Some(palette) = base16_palette { - let komorebi_theme = KomorebiTheme::Custom { + let komorebi_theme = KomorebiTheme::Custom(KomorebiThemeCustom { colours: Box::new(palette), single_border: wallpaper .theme_options @@ -1384,20 +1385,8 @@ impl Workspace { .theme_options .as_ref() .and_then(|o| o.unfocused_locked_border), - // stackbar_focused_text: wallpaper - // .theme_options - // .as_ref() - // .and_then(|o| o.stackbar_focused_text), - // stackbar_unfocused_text: wallpaper - // .theme_options - // .as_ref() - // .and_then(|o| o.stackbar_unfocused_text), - // stackbar_background: wallpaper - // .theme_options - // .as_ref() - // .and_then(|o| o.stackbar_background), bar_accent: wallpaper.theme_options.as_ref().and_then(|o| o.bar_accent), - }; + }); let bytes = SocketMessage::Theme(Box::new(komorebi_theme)).as_bytes()?; diff --git a/nix/komorebi-bar-options.nix b/nix/komorebi-bar-options.nix index 622252b3..3dcdfb9a 100644 --- a/nix/komorebi-bar-options.nix +++ b/nix/komorebi-bar-options.nix @@ -425,19 +425,36 @@ let type = ( lib.types.nullOr ( lib.types.listOf ( - lib.types.nullOr ( - lib.types.enum [ - "BSP" - "Columns" - "Rows" - "VerticalStack" - "HorizontalStack" - "UltrawideVerticalStack" - "Grid" - "RightMainVerticalStack" - "Scrolling" - ] - ) + lib.types.oneOf [ + (lib.types.enum [ + "Monocle" + "Floating" + "Paused" + "Custom" + ]) + (lib.types.submodule { + options = { + Default = lib.mkOption { + type = ( + lib.types.nullOr ( + lib.types.enum [ + "BSP" + "Columns" + "Rows" + "VerticalStack" + "HorizontalStack" + "UltrawideVerticalStack" + "Grid" + "RightMainVerticalStack" + "Scrolling" + ] + ) + ); + default = null; + }; + }; + }) + ] ) ) ); @@ -1020,17 +1037,6 @@ in ); default = null; }; - auto_select_text = lib.mkOption { - type = ( - lib.types.nullOr ( - lib.types.oneOf [ - (lib.types.nullOr catppuccinValue) - (lib.types.nullOr base16Value) - ] - ) - ); - default = null; - }; auto_select_fill = lib.mkOption { type = ( lib.types.nullOr ( @@ -1042,7 +1048,7 @@ in ); default = null; }; - accent = lib.mkOption { + auto_select_text = lib.mkOption { type = ( lib.types.nullOr ( lib.types.oneOf [ @@ -1339,6 +1345,17 @@ in ); default = null; }; + accent = lib.mkOption { + type = ( + lib.types.nullOr ( + lib.types.oneOf [ + (lib.types.nullOr catppuccinValue) + (lib.types.nullOr base16Value) + ] + ) + ); + default = null; + }; }; } ) diff --git a/nix/komorebi-options.nix b/nix/komorebi-options.nix index f3d604ae..9ca7a9b6 100644 --- a/nix/komorebi-options.nix +++ b/nix/komorebi-options.nix @@ -755,28 +755,6 @@ in ] ); }; - bar_accent = lib.mkOption { - type = ( - lib.types.nullOr ( - lib.types.oneOf [ - (lib.types.nullOr catppuccinValue) - (lib.types.nullOr base16Value) - ] - ) - ); - default = null; - }; - monocle_border = lib.mkOption { - type = ( - lib.types.nullOr ( - lib.types.oneOf [ - (lib.types.nullOr catppuccinValue) - (lib.types.nullOr base16Value) - ] - ) - ); - default = null; - }; stack_border = lib.mkOption { type = ( lib.types.nullOr ( @@ -788,7 +766,7 @@ in ); default = null; }; - unfocused_locked_border = lib.mkOption { + unfocused_border = lib.mkOption { type = ( lib.types.nullOr ( lib.types.oneOf [ @@ -810,6 +788,17 @@ in ); default = null; }; + unfocused_locked_border = lib.mkOption { + type = ( + lib.types.nullOr ( + lib.types.oneOf [ + (lib.types.nullOr catppuccinValue) + (lib.types.nullOr base16Value) + ] + ) + ); + default = null; + }; colours = lib.mkOption { type = ( lib.types.nullOr ( @@ -896,7 +885,18 @@ in ); default = null; }; - unfocused_border = lib.mkOption { + bar_accent = lib.mkOption { + type = ( + lib.types.nullOr ( + lib.types.oneOf [ + (lib.types.nullOr catppuccinValue) + (lib.types.nullOr base16Value) + ] + ) + ); + default = null; + }; + monocle_border = lib.mkOption { type = ( lib.types.nullOr ( lib.types.oneOf [ diff --git a/schema.bar.json b/schema.bar.json index 873cb22d..16be74c5 100644 --- a/schema.bar.json +++ b/schema.bar.json @@ -1863,22 +1863,22 @@ "description": "Catppuccin palette", "oneOf": [ { - "description": "Frappe", + "description": "Frappe (https://catppuccin.com/palette#flavor-frappe)", "type": "string", "const": "Frappe" }, { - "description": "Latte", + "description": "Latte (https://catppuccin.com/palette#flavor-latte)", "type": "string", "const": "Latte" }, { - "description": "Macchiato", + "description": "Macchiato (https://catppuccin.com/palette#flavor-macchiato)", "type": "string", "const": "Macchiato" }, { - "description": "Mocha", + "description": "Mocha (https://catppuccin.com/palette#flavor-mocha)", "type": "string", "const": "Mocha" } @@ -2523,48 +2523,14 @@ "description": "Theme from catppuccin-egui", "type": "object", "properties": { - "accent": { - "anyOf": [ - { - "$ref": "#/$defs/CatppuccinValue" - }, - { - "type": "null" - } - ] - }, - "auto_select_fill": { - "anyOf": [ - { - "$ref": "#/$defs/CatppuccinValue" - }, - { - "type": "null" - } - ] - }, - "auto_select_text": { - "anyOf": [ - { - "$ref": "#/$defs/CatppuccinValue" - }, - { - "type": "null" - } - ] - }, - "name": { - "description": "Name of the Catppuccin theme (theme previews: https://github.com/catppuccin/catppuccin)", - "$ref": "#/$defs/Catppuccin" - }, "palette": { "type": "string", "const": "Catppuccin" } }, + "$ref": "#/$defs/KomobarThemeCatppuccin", "required": [ - "palette", - "name" + "palette" ] }, { @@ -2572,48 +2538,14 @@ "description": "Theme from base16-egui-themes", "type": "object", "properties": { - "accent": { - "anyOf": [ - { - "$ref": "#/$defs/Base16Value" - }, - { - "type": "null" - } - ] - }, - "auto_select_fill": { - "anyOf": [ - { - "$ref": "#/$defs/Base16Value" - }, - { - "type": "null" - } - ] - }, - "auto_select_text": { - "anyOf": [ - { - "$ref": "#/$defs/Base16Value" - }, - { - "type": "null" - } - ] - }, - "name": { - "description": "Name of the Base16 theme (theme previews: https://tinted-theming.github.io/tinted-gallery/)", - "$ref": "#/$defs/Base16" - }, "palette": { "type": "string", "const": "Base16" } }, + "$ref": "#/$defs/KomobarThemeBase16", "required": [ - "palette", - "name" + "palette" ] }, { @@ -2621,52 +2553,159 @@ "description": "Custom Base16 theme", "type": "object", "properties": { - "accent": { - "anyOf": [ - { - "$ref": "#/$defs/Base16Value" - }, - { - "type": "null" - } - ] - }, - "auto_select_fill": { - "anyOf": [ - { - "$ref": "#/$defs/Base16Value" - }, - { - "type": "null" - } - ] - }, - "auto_select_text": { - "anyOf": [ - { - "$ref": "#/$defs/Base16Value" - }, - { - "type": "null" - } - ] - }, - "colours": { - "description": "Colours of the custom Base16 theme palette", - "$ref": "#/$defs/Base16ColourPalette" - }, "palette": { "type": "string", "const": "Custom" } }, + "$ref": "#/$defs/KomobarThemeCustom", "required": [ - "palette", - "colours" + "palette" ] } ] }, + "KomobarThemeBase16": { + "description": "Theme from base16-egui-themes", + "type": "object", + "properties": { + "accent": { + "description": "Accent colour", + "anyOf": [ + { + "$ref": "#/$defs/Base16Value" + }, + { + "type": "null" + } + ], + "default": "Base0D" + }, + "auto_select_fill": { + "description": "Auto select fill colour", + "anyOf": [ + { + "$ref": "#/$defs/Base16Value" + }, + { + "type": "null" + } + ] + }, + "auto_select_text": { + "description": "Auto select text colour", + "anyOf": [ + { + "$ref": "#/$defs/Base16Value" + }, + { + "type": "null" + } + ] + }, + "name": { + "description": "Name of the Base16 theme (previews: https://tinted-theming.github.io/tinted-gallery/)", + "$ref": "#/$defs/Base16" + } + }, + "required": [ + "name" + ] + }, + "KomobarThemeCatppuccin": { + "description": "Theme from catppuccin-egui", + "type": "object", + "properties": { + "accent": { + "description": "Accent colour", + "anyOf": [ + { + "$ref": "#/$defs/CatppuccinValue" + }, + { + "type": "null" + } + ], + "default": "Blue" + }, + "auto_select_fill": { + "description": "Auto select fill colour", + "anyOf": [ + { + "$ref": "#/$defs/CatppuccinValue" + }, + { + "type": "null" + } + ] + }, + "auto_select_text": { + "description": "Auto select text colour", + "anyOf": [ + { + "$ref": "#/$defs/CatppuccinValue" + }, + { + "type": "null" + } + ] + }, + "name": { + "description": "Name of the Catppuccin theme (previews: https://github.com/catppuccin/catppuccin)", + "$ref": "#/$defs/Catppuccin" + } + }, + "required": [ + "name" + ] + }, + "KomobarThemeCustom": { + "description": "Theme from base16-egui-themes", + "type": "object", + "properties": { + "accent": { + "description": "Accent colour", + "anyOf": [ + { + "$ref": "#/$defs/Base16Value" + }, + { + "type": "null" + } + ], + "default": "Blue" + }, + "auto_select_fill": { + "description": "Auto select fill colour", + "anyOf": [ + { + "$ref": "#/$defs/Base16Value" + }, + { + "type": "null" + } + ] + }, + "auto_select_text": { + "description": "Auto select text colour", + "anyOf": [ + { + "$ref": "#/$defs/Base16Value" + }, + { + "type": "null" + } + ] + }, + "colours": { + "description": "Colours of the custom Base16 theme palette", + "$ref": "#/$defs/Base16ColourPalette" + } + }, + "required": [ + "colours" + ] + }, "KomorebiConfig": { "description": "Komorebi widget configuration", "type": "object", diff --git a/schema.json b/schema.json index 54827fb1..9006e443 100644 --- a/schema.json +++ b/schema.json @@ -2238,22 +2238,22 @@ "description": "Catppuccin palette", "oneOf": [ { - "description": "Frappe", + "description": "Frappe (https://catppuccin.com/palette#flavor-frappe)", "type": "string", "const": "Frappe" }, { - "description": "Latte", + "description": "Latte (https://catppuccin.com/palette#flavor-latte)", "type": "string", "const": "Latte" }, { - "description": "Macchiato", + "description": "Macchiato (https://catppuccin.com/palette#flavor-macchiato)", "type": "string", "const": "Macchiato" }, { - "description": "Mocha", + "description": "Mocha (https://catppuccin.com/palette#flavor-mocha)", "type": "string", "const": "Mocha" } @@ -2542,315 +2542,342 @@ "oneOf": [ { "title": "Catppuccin", - "description": "A theme from catppuccin-egui", + "description": "Theme from catppuccin-egui", "type": "object", "properties": { - "bar_accent": { - "description": "Komorebi status bar accent", - "anyOf": [ - { - "$ref": "#/$defs/CatppuccinValue" - }, - { - "type": "null" - } - ], - "default": "Blue" - }, - "floating_border": { - "description": "Border colour when the window is floating", - "anyOf": [ - { - "$ref": "#/$defs/CatppuccinValue" - }, - { - "type": "null" - } - ], - "default": "Yellow" - }, - "monocle_border": { - "description": "Border colour when the container is in monocle mode", - "anyOf": [ - { - "$ref": "#/$defs/CatppuccinValue" - }, - { - "type": "null" - } - ], - "default": "Pink" - }, - "name": { - "description": "Name of the Catppuccin theme (theme previews: https://github.com/catppuccin/catppuccin)", - "$ref": "#/$defs/Catppuccin" - }, "palette": { "type": "string", "const": "Catppuccin" - }, - "single_border": { - "description": "Border colour when the container contains a single window", - "anyOf": [ - { - "$ref": "#/$defs/CatppuccinValue" - }, - { - "type": "null" - } - ], - "default": "Blue" - }, - "stack_border": { - "description": "Border colour when the container contains multiple windows", - "anyOf": [ - { - "$ref": "#/$defs/CatppuccinValue" - }, - { - "type": "null" - } - ], - "default": "Green" - }, - "unfocused_border": { - "description": "Border colour when the container is unfocused", - "anyOf": [ - { - "$ref": "#/$defs/CatppuccinValue" - }, - { - "type": "null" - } - ], - "default": "Base" - }, - "unfocused_locked_border": { - "description": "Border colour when the container is unfocused and locked", - "anyOf": [ - { - "$ref": "#/$defs/CatppuccinValue" - }, - { - "type": "null" - } - ], - "default": "Red" } }, + "$ref": "#/$defs/KomorebiThemeCatppuccin", "required": [ - "palette", - "name" + "palette" ] }, { "title": "Base16", - "description": "A theme from base16-egui-themes", + "description": "Theme from base16-egui-themes", "type": "object", "properties": { - "bar_accent": { - "description": "Komorebi status bar accent", - "anyOf": [ - { - "$ref": "#/$defs/Base16Value" - }, - { - "type": "null" - } - ], - "default": "Base0D" - }, - "floating_border": { - "description": "Border colour when the window is floating", - "anyOf": [ - { - "$ref": "#/$defs/Base16Value" - }, - { - "type": "null" - } - ], - "default": "Base09" - }, - "monocle_border": { - "description": "Border colour when the container is in monocle mode", - "anyOf": [ - { - "$ref": "#/$defs/Base16Value" - }, - { - "type": "null" - } - ], - "default": "Base0F" - }, - "name": { - "description": "Name of the Base16 theme (theme previews: https://tinted-theming.github.io/tinted-gallery/)", - "$ref": "#/$defs/Base16" - }, "palette": { "type": "string", "const": "Base16" - }, - "single_border": { - "description": "Border colour when the container contains a single window", - "anyOf": [ - { - "$ref": "#/$defs/Base16Value" - }, - { - "type": "null" - } - ], - "default": "Base0D" - }, - "stack_border": { - "description": "Border colour when the container contains multiple windows", - "anyOf": [ - { - "$ref": "#/$defs/Base16Value" - }, - { - "type": "null" - } - ], - "default": "Base0B" - }, - "unfocused_border": { - "description": "Border colour when the container is unfocused", - "anyOf": [ - { - "$ref": "#/$defs/Base16Value" - }, - { - "type": "null" - } - ], - "default": "Base01" - }, - "unfocused_locked_border": { - "description": "Border colour when the container is unfocused and locked", - "anyOf": [ - { - "$ref": "#/$defs/Base16Value" - }, - { - "type": "null" - } - ], - "default": "Base08" } }, + "$ref": "#/$defs/KomorebiThemeBase16", "required": [ - "palette", - "name" + "palette" ] }, { "title": "Custom", - "description": "A custom Base16 theme", + "description": "Custom Base16 theme", "type": "object", "properties": { - "bar_accent": { - "description": "Komorebi status bar accent", - "anyOf": [ - { - "$ref": "#/$defs/Base16Value" - }, - { - "type": "null" - } - ], - "default": "Base0D" - }, - "colours": { - "description": "Colours of the custom Base16 theme palette", - "$ref": "#/$defs/Base16ColourPalette" - }, - "floating_border": { - "description": "Border colour when the window is floating", - "anyOf": [ - { - "$ref": "#/$defs/Base16Value" - }, - { - "type": "null" - } - ], - "default": "Base09" - }, - "monocle_border": { - "description": "Border colour when the container is in monocle mode", - "anyOf": [ - { - "$ref": "#/$defs/Base16Value" - }, - { - "type": "null" - } - ], - "default": "Base0F" - }, "palette": { "type": "string", "const": "Custom" - }, - "single_border": { - "description": "Border colour when the container contains a single window", - "anyOf": [ - { - "$ref": "#/$defs/Base16Value" - }, - { - "type": "null" - } - ], - "default": "Base0D" - }, - "stack_border": { - "description": "Border colour when the container contains multiple windows", - "anyOf": [ - { - "$ref": "#/$defs/Base16Value" - }, - { - "type": "null" - } - ], - "default": "Base0B" - }, - "unfocused_border": { - "description": "Border colour when the container is unfocused", - "anyOf": [ - { - "$ref": "#/$defs/Base16Value" - }, - { - "type": "null" - } - ], - "default": "Base01" - }, - "unfocused_locked_border": { - "description": "Border colour when the container is unfocused and locked", - "anyOf": [ - { - "$ref": "#/$defs/Base16Value" - }, - { - "type": "null" - } - ], - "default": "Base08" } }, + "$ref": "#/$defs/KomorebiThemeCustom", "required": [ - "palette", - "colours" + "palette" ] } ] }, + "KomorebiThemeBase16": { + "description": "Theme from base16-egui-themes", + "type": "object", + "properties": { + "bar_accent": { + "description": "Bar accent colour", + "anyOf": [ + { + "$ref": "#/$defs/Base16Value" + }, + { + "type": "null" + } + ], + "default": "Base0D" + }, + "floating_border": { + "description": "Floating window border colour", + "anyOf": [ + { + "$ref": "#/$defs/Base16Value" + }, + { + "type": "null" + } + ], + "default": "Base09" + }, + "monocle_border": { + "description": "Monocle window border colour", + "anyOf": [ + { + "$ref": "#/$defs/Base16Value" + }, + { + "type": "null" + } + ], + "default": "Base0F" + }, + "name": { + "description": "Name of the Base16 theme (theme previews: https://tinted-theming.github.io/tinted-gallery/)", + "$ref": "#/$defs/Base16" + }, + "single_border": { + "description": "Single window border colour", + "anyOf": [ + { + "$ref": "#/$defs/Base16Value" + }, + { + "type": "null" + } + ], + "default": "Base0D" + }, + "stack_border": { + "description": "Stack window border colour", + "anyOf": [ + { + "$ref": "#/$defs/Base16Value" + }, + { + "type": "null" + } + ], + "default": "Base0B" + }, + "unfocused_border": { + "description": "Unfocused window border colour", + "anyOf": [ + { + "$ref": "#/$defs/Base16Value" + }, + { + "type": "null" + } + ], + "default": "Base01" + }, + "unfocused_locked_border": { + "description": "Unfocused locked window border colour", + "anyOf": [ + { + "$ref": "#/$defs/Base16Value" + }, + { + "type": "null" + } + ], + "default": "Base08" + } + }, + "required": [ + "name" + ] + }, + "KomorebiThemeCatppuccin": { + "description": "Theme from catppuccin-egui", + "type": "object", + "properties": { + "bar_accent": { + "description": "Bar accent colour", + "anyOf": [ + { + "$ref": "#/$defs/CatppuccinValue" + }, + { + "type": "null" + } + ], + "default": "Blue" + }, + "floating_border": { + "description": "Floating window border colour", + "anyOf": [ + { + "$ref": "#/$defs/CatppuccinValue" + }, + { + "type": "null" + } + ], + "default": "Yellow" + }, + "monocle_border": { + "description": "Monocle window border colour", + "anyOf": [ + { + "$ref": "#/$defs/CatppuccinValue" + }, + { + "type": "null" + } + ], + "default": "Pink" + }, + "name": { + "description": "Name of the Catppuccin theme (previews: https://github.com/catppuccin/catppuccin)", + "$ref": "#/$defs/Catppuccin" + }, + "single_border": { + "description": "Single window border colour", + "anyOf": [ + { + "$ref": "#/$defs/CatppuccinValue" + }, + { + "type": "null" + } + ], + "default": "Blue" + }, + "stack_border": { + "description": "Stack window border colour", + "anyOf": [ + { + "$ref": "#/$defs/CatppuccinValue" + }, + { + "type": "null" + } + ], + "default": "Green" + }, + "unfocused_border": { + "description": "Unfocused window border colour", + "anyOf": [ + { + "$ref": "#/$defs/CatppuccinValue" + }, + { + "type": "null" + } + ], + "default": "Base" + }, + "unfocused_locked_border": { + "description": "Unfocused locked window border colour", + "anyOf": [ + { + "$ref": "#/$defs/CatppuccinValue" + }, + { + "type": "null" + } + ], + "default": "Red" + } + }, + "required": [ + "name" + ] + }, + "KomorebiThemeCustom": { + "description": "Custom Base16 theme", + "type": "object", + "properties": { + "bar_accent": { + "description": "Bar accent colour", + "anyOf": [ + { + "$ref": "#/$defs/Base16Value" + }, + { + "type": "null" + } + ], + "default": "Base0D" + }, + "colours": { + "description": "Colours of the custom Base16 theme palette", + "$ref": "#/$defs/Base16ColourPalette" + }, + "floating_border": { + "description": "Floating window border colour", + "anyOf": [ + { + "$ref": "#/$defs/Base16Value" + }, + { + "type": "null" + } + ], + "default": "Base09" + }, + "monocle_border": { + "description": "Monocle window border colour", + "anyOf": [ + { + "$ref": "#/$defs/Base16Value" + }, + { + "type": "null" + } + ], + "default": "Base0F" + }, + "single_border": { + "description": "Single window border colour", + "anyOf": [ + { + "$ref": "#/$defs/Base16Value" + }, + { + "type": "null" + } + ], + "default": "Base0D" + }, + "stack_border": { + "description": "Stack window border colour", + "anyOf": [ + { + "$ref": "#/$defs/Base16Value" + }, + { + "type": "null" + } + ], + "default": "Base0B" + }, + "unfocused_border": { + "description": "Unfocused window border colour", + "anyOf": [ + { + "$ref": "#/$defs/Base16Value" + }, + { + "type": "null" + } + ], + "default": "Base01" + }, + "unfocused_locked_border": { + "description": "Unfocused locked window border colour", + "anyOf": [ + { + "$ref": "#/$defs/Base16Value" + }, + { + "type": "null" + } + ], + "default": "Base08" + } + }, + "required": [ + "colours" + ] + }, "LayoutOptions": { "description": "Options for specific layouts", "type": "object",