From d9261414c2f478fa50feab6e0d2c67d31ffae888 Mon Sep 17 00:00:00 2001 From: kossLAN Date: Fri, 29 May 2026 17:08:06 -0400 Subject: [PATCH] config: move rule match schema into schema crate --- jay-config-schema/src/lib.rs | 2 + jay-config-schema/src/rules.rs | 63 ++++++++++++++++++++++++++++++ toml-config/src/config.rs | 71 +++------------------------------- 3 files changed, 70 insertions(+), 66 deletions(-) create mode 100644 jay-config-schema/src/rules.rs diff --git a/jay-config-schema/src/lib.rs b/jay-config-schema/src/lib.rs index 4b1605f1..a50b64c5 100644 --- a/jay-config-schema/src/lib.rs +++ b/jay-config-schema/src/lib.rs @@ -9,6 +9,7 @@ pub mod command; pub mod input; pub mod options; pub mod output; +pub mod rules; pub mod theme; pub use animations::{AnimationCurveConfig, Animations}; @@ -21,4 +22,5 @@ pub use options::{ pub use output::{ ConfigConnector, ConfigDrmDevice, ConnectorMatch, DrmDeviceMatch, Mode, Output, OutputMatch, }; +pub use rules::{ClientMatch, GenericMatch, MatchExactly, WindowMatch}; pub use theme::Theme; diff --git a/jay-config-schema/src/rules.rs b/jay-config-schema/src/rules.rs new file mode 100644 index 00000000..da36cc89 --- /dev/null +++ b/jay-config-schema/src/rules.rs @@ -0,0 +1,63 @@ +use jay_config::window::{ContentType, WindowType}; + +#[derive(Default, Debug, Clone)] +pub struct GenericMatch { + pub name: Option, + pub not: Option>, + pub all: Option>, + pub any: Option>, + pub exactly: Option>, +} + +#[derive(Debug, Clone)] +pub struct MatchExactly { + pub num: usize, + pub list: Vec, +} + +#[derive(Default, Debug, Clone)] +pub struct ClientMatch { + pub generic: GenericMatch, + pub sandbox_engine: Option, + pub sandbox_engine_regex: Option, + pub sandbox_app_id: Option, + pub sandbox_app_id_regex: Option, + pub sandbox_instance_id: Option, + pub sandbox_instance_id_regex: Option, + pub sandboxed: Option, + pub uid: Option, + pub pid: Option, + pub is_xwayland: Option, + pub comm: Option, + pub comm_regex: Option, + pub exe: Option, + pub exe_regex: Option, +} + +#[derive(Default, Debug, Clone)] +pub struct WindowMatch { + pub generic: GenericMatch, + pub types: Option, + pub client: Option, + pub title: Option, + pub title_regex: Option, + pub app_id: Option, + pub app_id_regex: Option, + pub floating: Option, + pub visible: Option, + pub urgent: Option, + pub focused: Option, + pub fullscreen: Option, + pub just_mapped: Option, + pub tag: Option, + pub tag_regex: Option, + pub x_class: Option, + pub x_class_regex: Option, + pub x_instance: Option, + pub x_instance_regex: Option, + pub x_role: Option, + pub x_role_regex: Option, + pub workspace: Option, + pub workspace_regex: Option, + pub content_types: Option, +} diff --git a/toml-config/src/config.rs b/toml-config/src/config.rs index e2b90214..bdc9c736 100644 --- a/toml-config/src/config.rs +++ b/toml-config/src/config.rs @@ -28,7 +28,7 @@ use { keyboard::{Keymap, ModifiedKeySym, mods::Modifiers, syms::KeySym}, logging::LogLevel, video::GfxApi, - window::{ContentType, TileState, WindowType}, + window::TileState, workspace::WorkspaceDisplayOrder, }, std::{ @@ -42,9 +42,10 @@ use { }; pub use jay_config_schema::{ - AnimationCurveConfig, Animations, ColorManagement, ConfigConnector, ConfigDrmDevice, - ConnectorMatch, DrmDeviceMatch, Exec, Float, FocusHistory, InputMatch, Libei, Mode, Output, - OutputMatch, RepeatRate, SimpleIm, Status, Tearing, Theme, UiDrag, Vrr, Xwayland, + AnimationCurveConfig, Animations, ClientMatch, ColorManagement, ConfigConnector, + ConfigDrmDevice, ConnectorMatch, DrmDeviceMatch, Exec, Float, FocusHistory, GenericMatch, + InputMatch, Libei, MatchExactly, Mode, Output, OutputMatch, RepeatRate, SimpleIm, Status, + Tearing, Theme, UiDrag, Vrr, WindowMatch, Xwayland, }; #[derive(Debug, Copy, Clone)] @@ -203,21 +204,6 @@ pub enum Action { }, } -#[derive(Default, Debug, Clone)] -pub struct GenericMatch { - pub name: Option, - pub not: Option>, - pub all: Option>, - pub any: Option>, - pub exactly: Option>, -} - -#[derive(Debug, Clone)] -pub struct MatchExactly { - pub num: usize, - pub list: Vec, -} - #[derive(Debug, Clone)] pub struct ClientRule { pub name: Option, @@ -226,25 +212,6 @@ pub struct ClientRule { pub latch: Option, } -#[derive(Default, Debug, Clone)] -pub struct ClientMatch { - pub generic: GenericMatch, - pub sandbox_engine: Option, - pub sandbox_engine_regex: Option, - pub sandbox_app_id: Option, - pub sandbox_app_id_regex: Option, - pub sandbox_instance_id: Option, - pub sandbox_instance_id_regex: Option, - pub sandboxed: Option, - pub uid: Option, - pub pid: Option, - pub is_xwayland: Option, - pub comm: Option, - pub comm_regex: Option, - pub exe: Option, - pub exe_regex: Option, -} - #[derive(Debug, Clone)] pub struct WindowRule { pub name: Option, @@ -255,34 +222,6 @@ pub struct WindowRule { pub initial_tile_state: Option, } -#[derive(Default, Debug, Clone)] -pub struct WindowMatch { - pub generic: GenericMatch, - pub types: Option, - pub client: Option, - pub title: Option, - pub title_regex: Option, - pub app_id: Option, - pub app_id_regex: Option, - pub floating: Option, - pub visible: Option, - pub urgent: Option, - pub focused: Option, - pub fullscreen: Option, - pub just_mapped: Option, - pub tag: Option, - pub tag_regex: Option, - pub x_class: Option, - pub x_class_regex: Option, - pub x_instance: Option, - pub x_instance_regex: Option, - pub x_role: Option, - pub x_role_regex: Option, - pub workspace: Option, - pub workspace_regex: Option, - pub content_types: Option, -} - #[derive(Debug, Clone)] pub struct Input { pub tag: Option,