diff --git a/komorebi-for-mac/komorebi/src/core/mod.rs b/komorebi-for-mac/komorebi/src/core/mod.rs index b97aeb17..2e51b8bd 100644 --- a/komorebi-for-mac/komorebi/src/core/mod.rs +++ b/komorebi-for-mac/komorebi/src/core/mod.rs @@ -1,8 +1,5 @@ -use clap::ValueEnum; use serde::Deserialize; use serde::Serialize; -use strum::Display; -use strum::EnumString; // Re-export types from komorebi-layouts pub use komorebi_layouts::Arrangement; @@ -32,6 +29,11 @@ pub use komorebi_layouts::validate_ratios; pub mod animation; pub mod asc; pub mod config_generation; +pub use komorebi_config::behaviour::CrossBoundaryBehaviour; +pub use komorebi_config::behaviour::FloatingLayerBehaviour; +pub use komorebi_config::behaviour::Placement; +pub use komorebi_config::behaviour::WindowContainerBehaviour; +pub use komorebi_config::behaviour::WindowHidingPosition; pub use komorebi_protocol::pathext; pub use komorebi_protocol::types::ApplicationIdentifier; pub use komorebi_protocol::types::MonocleFocusBehaviour; @@ -67,98 +69,6 @@ pub struct WindowManagementBehaviour { pub float_rule_placement: Placement, } -#[derive( - Clone, Copy, Debug, Default, Serialize, Deserialize, Display, EnumString, ValueEnum, PartialEq, -)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Window container behaviour when a new window is opened -pub enum WindowContainerBehaviour { - /// Create a new container for each new window - #[default] - Create, - /// Append new windows to the focused window container - Append, -} - -#[derive( - Clone, Copy, Debug, Default, Serialize, Deserialize, Display, EnumString, ValueEnum, PartialEq, -)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Floating layer behaviour when a new window is opened -pub enum FloatingLayerBehaviour { - /// Tile new windows (unless they match a float rule or float override is active) - #[default] - Tile, - /// Float new windows - Float, -} - -#[derive( - Clone, Copy, Debug, Default, Serialize, Deserialize, Display, EnumString, ValueEnum, PartialEq, -)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Window hiding position -pub enum WindowHidingPosition { - /// Hide windows in the bottom left corner of the screen - #[default] - BottomLeft, - /// Hide windows in the bottom right corner of the screen - BottomRight, -} - -#[derive( - Clone, Copy, Debug, Default, Serialize, Deserialize, Display, EnumString, ValueEnum, PartialEq, -)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Placement behaviour for floating windows -pub enum Placement { - /// Does not change the size or position of the window - #[default] - None, - /// Center the window without changing the size - Center, - /// Center the window and resize it according to the `AspectRatio` - CenterAndResize, -} - -impl FloatingLayerBehaviour { - pub fn should_float(&self) -> bool { - match self { - FloatingLayerBehaviour::Tile => false, - FloatingLayerBehaviour::Float => true, - } - } -} - -impl Placement { - pub fn should_center(&self) -> bool { - match self { - Placement::None => false, - Placement::Center | Placement::CenterAndResize => true, - } - } - - pub fn should_resize(&self) -> bool { - match self { - Placement::None | Placement::Center => false, - Placement::CenterAndResize => true, - } - } -} - -#[derive( - Clone, Copy, Debug, Default, Serialize, Deserialize, Display, EnumString, ValueEnum, PartialEq, -)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Behaviour when an action would cross a monitor boundary -pub enum CrossBoundaryBehaviour { - /// Attempt to perform actions across a workspace boundary - Workspace, - /// Attempt to perform actions across a monitor boundary - #[default] - Monitor, -} - pub use komorebi_protocol::message::SocketMessage; #[cfg(test)]