From 99358e36b38c1aa5cc0c0fb36a91ae7cb4a2e3ba Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Fri, 25 Apr 2025 07:55:45 +0300 Subject: layout/monitor: Extract activate_workspace_with_anim_config() --- src/layout/monitor.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/layout/monitor.rs b/src/layout/monitor.rs index 06a01769..4c20d533 100644 --- a/src/layout/monitor.rs +++ b/src/layout/monitor.rs @@ -287,7 +287,15 @@ impl Monitor { self.add_workspace_at(self.workspaces.len()); } - fn activate_workspace(&mut self, idx: usize) { + pub fn activate_workspace(&mut self, idx: usize) { + self.activate_workspace_with_anim_config(idx, None); + } + + pub fn activate_workspace_with_anim_config( + &mut self, + idx: usize, + config: Option, + ) { if self.active_workspace_idx == idx { return; } @@ -299,12 +307,13 @@ impl Monitor { self.active_workspace_idx = idx; + let config = config.unwrap_or(self.options.animations.workspace_switch.0); self.workspace_switch = Some(WorkspaceSwitch::Animation(Animation::new( self.clock.clone(), current_idx, idx as f64, 0., - self.options.animations.workspace_switch.0, + config, ))); } -- cgit