forge
Explore
Log in

Don't you dare go Hollow

layout/monitor: Extract activate_workspace_with_anim_config()

Browse files at this commit

99358e36b38c1aa5cc0c0fb36a91ae7cb4a2e3baIvan MolodetskikhParent: 8b878f3
src/layout/monitor.rsmodified+11 -2
@@ -287,7 +287,15 @@ impl<W: LayoutElement> Monitor<W> {
287287 self.add_workspace_at(self.workspaces.len());
288288 }
289289
290- fn activate_workspace(&mut self, idx: usize) {
290+ pub fn activate_workspace(&mut self, idx: usize) {
291+ self.activate_workspace_with_anim_config(idx, None);
292+ }
293+
294+ pub fn activate_workspace_with_anim_config(
295+ &mut self,
296+ idx: usize,
297+ config: Option<niri_config::Animation>,
298+ ) {
291299 if self.active_workspace_idx == idx {
292300 return;
293301 }
@@ -299,12 +307,13 @@ impl<W: LayoutElement> Monitor<W> {
299307
300308 self.active_workspace_idx = idx;
301309
310+ let config = config.unwrap_or(self.options.animations.workspace_switch.0);
302311 self.workspace_switch = Some(WorkspaceSwitch::Animation(Animation::new(
303312 self.clock.clone(),
304313 current_idx,
305314 idx as f64,
306315 0.,
307- self.options.animations.workspace_switch.0,
316+ config,
308317 )));
309318 }
310319