From 41e7fcc2909b531dd4622b19901e9d43346899de Mon Sep 17 00:00:00 2001 From: kossLAN Date: Fri, 29 May 2026 17:01:28 -0400 Subject: [PATCH] config: move parser option structs into schema crate --- jay-config-schema/src/lib.rs | 5 ++++- jay-config-schema/src/options.rs | 16 ++++++++++++++++ toml-config/src/config.rs | 6 ++---- .../src/config/parsers/color_management.rs | 6 +----- toml-config/src/config/parsers/float.rs | 6 +----- toml-config/src/config/parsers/focus_history.rs | 7 +------ 6 files changed, 25 insertions(+), 21 deletions(-) diff --git a/jay-config-schema/src/lib.rs b/jay-config-schema/src/lib.rs index 868aaa1d..3e432592 100644 --- a/jay-config-schema/src/lib.rs +++ b/jay-config-schema/src/lib.rs @@ -8,4 +8,7 @@ pub mod animations; pub mod options; pub use animations::{AnimationCurveConfig, Animations}; -pub use options::{Libei, RepeatRate, SimpleIm, Tearing, UiDrag, Vrr, Xwayland}; +pub use options::{ + ColorManagement, Float, FocusHistory, Libei, RepeatRate, SimpleIm, Tearing, UiDrag, Vrr, + Xwayland, +}; diff --git a/jay-config-schema/src/options.rs b/jay-config-schema/src/options.rs index e9d3d271..b528dcf5 100644 --- a/jay-config-schema/src/options.rs +++ b/jay-config-schema/src/options.rs @@ -9,6 +9,22 @@ pub struct UiDrag { pub threshold: Option, } +#[derive(Clone, Debug)] +pub struct ColorManagement { + pub enabled: Option, +} + +#[derive(Debug, Clone)] +pub struct Float { + pub show_pin_icon: Option, +} + +#[derive(Debug, Clone)] +pub struct FocusHistory { + pub only_visible: Option, + pub same_workspace: Option, +} + #[derive(Debug, Clone)] pub struct RepeatRate { pub rate: i32, diff --git a/toml-config/src/config.rs b/toml-config/src/config.rs index 0714f24c..919c4338 100644 --- a/toml-config/src/config.rs +++ b/toml-config/src/config.rs @@ -13,10 +13,7 @@ use { config::{ context::Context, parsers::{ - color_management::ColorManagement, config::{ConfigParser, ConfigParserError}, - float::Float, - focus_history::FocusHistory, }, }, toml::{self}, @@ -48,7 +45,8 @@ use { }; pub use jay_config_schema::{ - AnimationCurveConfig, Animations, Libei, RepeatRate, SimpleIm, Tearing, UiDrag, Vrr, Xwayland, + AnimationCurveConfig, Animations, ColorManagement, Float, FocusHistory, Libei, RepeatRate, + SimpleIm, Tearing, UiDrag, Vrr, Xwayland, }; #[derive(Debug, Copy, Clone)] diff --git a/toml-config/src/config/parsers/color_management.rs b/toml-config/src/config/parsers/color_management.rs index 53a64bb9..fc49bb5a 100644 --- a/toml-config/src/config/parsers/color_management.rs +++ b/toml-config/src/config/parsers/color_management.rs @@ -1,6 +1,7 @@ use { crate::{ config::{ + ColorManagement, context::Context, extractor::{Extractor, ExtractorError, bol, opt}, parser::{DataType, ParseResult, Parser, UnexpectedDataType}, @@ -24,11 +25,6 @@ pub enum ColorManagementParserError { pub struct ColorManagementParser<'a>(pub &'a Context<'a>); -#[derive(Clone, Debug)] -pub struct ColorManagement { - pub enabled: Option, -} - impl Parser for ColorManagementParser<'_> { type Value = ColorManagement; type Error = ColorManagementParserError; diff --git a/toml-config/src/config/parsers/float.rs b/toml-config/src/config/parsers/float.rs index fa3ccbed..e31c981e 100644 --- a/toml-config/src/config/parsers/float.rs +++ b/toml-config/src/config/parsers/float.rs @@ -1,6 +1,7 @@ use { crate::{ config::{ + Float, context::Context, extractor::{Extractor, ExtractorError, bol, opt, recover}, parser::{DataType, ParseResult, Parser, UnexpectedDataType}, @@ -24,11 +25,6 @@ pub enum FloatParserError { pub struct FloatParser<'a>(pub &'a Context<'a>); -#[derive(Debug, Clone)] -pub struct Float { - pub show_pin_icon: Option, -} - impl Parser for FloatParser<'_> { type Value = Float; type Error = FloatParserError; diff --git a/toml-config/src/config/parsers/focus_history.rs b/toml-config/src/config/parsers/focus_history.rs index 8aef1ebd..04c84a5d 100644 --- a/toml-config/src/config/parsers/focus_history.rs +++ b/toml-config/src/config/parsers/focus_history.rs @@ -1,6 +1,7 @@ use { crate::{ config::{ + FocusHistory, context::Context, extractor::{Extractor, ExtractorError, bol, opt, recover}, parser::{DataType, ParseResult, Parser, UnexpectedDataType}, @@ -24,12 +25,6 @@ pub enum FocusHistoryParserError { pub struct FocusHistoryParser<'a>(pub &'a Context<'a>); -#[derive(Debug, Clone)] -pub struct FocusHistory { - pub only_visible: Option, - pub same_workspace: Option, -} - impl Parser for FocusHistoryParser<'_> { type Value = FocusHistory; type Error = FocusHistoryParserError;