diff --git a/komorebi/src/animation/mod.rs b/komorebi/src/animation/mod.rs index 86578fac..abd27466 100644 --- a/komorebi/src/animation/mod.rs +++ b/komorebi/src/animation/mod.rs @@ -13,6 +13,7 @@ use std::time::Duration; use parking_lot::Mutex; pub use engine::AnimationEngine; +pub use komorebi_config::animation::PerAnimationPrefixConfig; pub mod animation_manager; pub mod engine; pub mod ghost; @@ -25,42 +26,6 @@ pub use render_dispatcher::RenderDispatcher; pub mod style; pub mod transition; -use serde::Deserialize; -use serde::Serialize; - -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[serde(untagged)] -/// Animation configuration -/// -/// This can be either global: -/// ```json -/// { -/// "enabled": true, -/// "style": "EaseInSine", -/// "fps": 60, -/// "duration": 250 -/// } -/// ``` -/// -/// Or scoped by an animation kind prefix: -/// ```json -/// { -/// "movement": { -/// "enabled": true, -/// "style": "EaseInSine", -/// "fps": 60, -/// "duration": 250 -/// } -/// } -/// ``` -pub enum PerAnimationPrefixConfig { - /// Animation configuration prefixed for a specific animation kind - Prefix(HashMap), - /// Animation configuration for all animation kinds - Global(T), -} - pub const DEFAULT_ANIMATION_ENABLED: bool = false; pub const DEFAULT_ANIMATION_STYLE: AnimationStyle = AnimationStyle::Linear; pub const DEFAULT_ANIMATION_DURATION: u64 = 250; diff --git a/komorebi/src/border_manager/mod.rs b/komorebi/src/border_manager/mod.rs index ccbb0a98..eba053d3 100644 --- a/komorebi/src/border_manager/mod.rs +++ b/komorebi/src/border_manager/mod.rs @@ -11,12 +11,12 @@ use crate::windows_api; use crate::workspace::Workspace; use crate::workspace::WorkspaceLayer; pub use border::Border; -pub use komorebi_config::behaviour::ZOrder; use border::border_hwnds; use crossbeam_channel::Receiver; use crossbeam_channel::Sender; use crossbeam_utils::atomic::AtomicCell; use crossbeam_utils::atomic::AtomicConsume; +pub use komorebi_config::behaviour::ZOrder; use komorebi_themes::colour::Colour; use komorebi_themes::colour::Rgb; use lazy_static::lazy_static; diff --git a/komorebi/src/core/mod.rs b/komorebi/src/core/mod.rs index 569bee03..2ae7849f 100644 --- a/komorebi/src/core/mod.rs +++ b/komorebi/src/core/mod.rs @@ -2,14 +2,12 @@ #![allow(clippy::missing_errors_doc, clippy::use_self, clippy::doc_markdown)] #![allow(deprecated)] // allow deprecated variants like HidingBehaviour::Hide to be used in derive macros - use clap::ValueEnum; use serde::Deserialize; use serde::Serialize; use strum::Display; use strum::EnumString; - // Re-export everything from komorebi-layouts pub use komorebi_layouts::Arrangement; pub use komorebi_layouts::Axis; diff --git a/komorebi/src/window.rs b/komorebi/src/window.rs index 2f9009a6..321b599c 100644 --- a/komorebi/src/window.rs +++ b/komorebi/src/window.rs @@ -44,6 +44,8 @@ use crate::windows_api; use crate::windows_api::WindowsApi; use color_eyre::eyre; use crossbeam_utils::atomic::AtomicConsume; +pub use komorebi_config::aspect_ratio::AspectRatio; +pub use komorebi_config::aspect_ratio::PredefinedAspectRatio; use regex::Regex; use serde::Deserialize; use serde::Serialize; @@ -58,8 +60,6 @@ use std::sync::atomic::AtomicI32; use std::sync::atomic::Ordering; use std::thread; use std::time::Duration; -use strum::Display; -use strum::EnumString; use windows::Win32::Foundation::HWND; pub static MINIMUM_WIDTH: AtomicI32 = AtomicI32::new(0); @@ -227,51 +227,6 @@ impl RenderDispatcher for TransparencyRenderDispatcher { } } -#[derive(Copy, Clone, Debug, Display, EnumString, Serialize, Deserialize, PartialEq)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -#[serde(untagged)] -/// Aspect ratio for temporarily floating windows -pub enum AspectRatio { - /// Predefined aspect ratio - #[cfg_attr(feature = "schemars", schemars(title = "Predefined"))] - Predefined(PredefinedAspectRatio), - /// Custom W:H aspect ratio - #[cfg_attr(feature = "schemars", schemars(title = "Custom"))] - Custom(i32, i32), -} - -impl Default for AspectRatio { - fn default() -> Self { - AspectRatio::Predefined(PredefinedAspectRatio::default()) - } -} - -#[derive(Copy, Clone, Debug, Default, Display, EnumString, Serialize, Deserialize, PartialEq)] -#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -/// Predefined aspect ratio -pub enum PredefinedAspectRatio { - /// 21:9 - Ultrawide, - /// 16:9 - Widescreen, - /// 4:3 - #[default] - Standard, -} - -impl AspectRatio { - pub fn width_and_height(self) -> (i32, i32) { - match self { - AspectRatio::Predefined(predefined) => match predefined { - PredefinedAspectRatio::Ultrawide => (21, 9), - PredefinedAspectRatio::Widescreen => (16, 9), - PredefinedAspectRatio::Standard => (4, 3), - }, - AspectRatio::Custom(w, h) => (w, h), - } - } -} - impl Window { pub const fn hwnd(self) -> HWND { HWND(windows_api::as_ptr!(self.hwnd))