From 6424a2738db6349de62dab150d5d6f1d431ca6c4 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Wed, 7 Feb 2024 17:05:15 +0400 Subject: Make all animations configurable --- src/layout/mod.rs | 6 +++++- src/layout/monitor.rs | 3 ++- src/layout/tile.rs | 9 +++++++-- src/layout/workspace.rs | 3 ++- 4 files changed, 16 insertions(+), 5 deletions(-) (limited to 'src/layout') diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 7c381358..c4bcc61f 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -158,6 +158,7 @@ pub struct Options { pub preset_widths: Vec, /// Initial width for new columns. pub default_width: Option, + pub animations: niri_config::Animations, } impl Default for Options { @@ -174,6 +175,7 @@ impl Default for Options { ColumnWidth::Proportion(2. / 3.), ], default_width: None, + animations: Default::default(), } } } @@ -209,6 +211,7 @@ impl Options { center_focused_column: layout.center_focused_column, preset_widths, default_width, + animations: config.animations, } } } @@ -1577,7 +1580,8 @@ impl Layout { monitor.workspace_switch = Some(WorkspaceSwitch::Animation(Animation::new( current_idx, idx as f64, - 250, + self.options.animations.workspace_switch, + niri_config::Animation::default_workspace_switch(), ))); return Some(monitor.output.clone()); diff --git a/src/layout/monitor.rs b/src/layout/monitor.rs index accce645..e67f5bf2 100644 --- a/src/layout/monitor.rs +++ b/src/layout/monitor.rs @@ -96,7 +96,8 @@ impl Monitor { self.workspace_switch = Some(WorkspaceSwitch::Animation(Animation::new( current_idx, idx as f64, - 250, + self.options.animations.workspace_switch, + niri_config::Animation::default_workspace_switch(), ))); } diff --git a/src/layout/tile.rs b/src/layout/tile.rs index be96f6e6..62f79a77 100644 --- a/src/layout/tile.rs +++ b/src/layout/tile.rs @@ -11,7 +11,7 @@ use smithay::utils::{Logical, Point, Rectangle, Scale, Size}; use super::focus_ring::FocusRing; use super::{LayoutElement, LayoutElementRenderElement, Options}; -use crate::animation::{Animation, Curve}; +use crate::animation::Animation; use crate::niri_render_elements; use crate::render_helpers::offscreen::OffscreenRenderElement; use crate::render_helpers::renderer::NiriRenderer; @@ -114,7 +114,12 @@ impl Tile { } pub fn start_open_animation(&mut self) { - self.open_animation = Some(Animation::new(0., 1., 150).with_curve(Curve::EaseOutExpo)); + self.open_animation = Some(Animation::new( + 0., + 1., + self.options.animations.window_open, + niri_config::Animation::default_window_open(), + )); } pub fn window(&self) -> &W { diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs index 9165d7e0..0e576b7a 100644 --- a/src/layout/workspace.rs +++ b/src/layout/workspace.rs @@ -401,7 +401,8 @@ impl Workspace { self.view_offset_anim = Some(Animation::new( self.view_offset as f64, new_view_offset as f64, - 250, + self.options.animations.horizontal_view_movement, + niri_config::Animation::default_horizontal_view_movement(), )); } -- cgit