aboutsummaryrefslogtreecommitdiff
path: root/src/layout/workspace.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/layout/workspace.rs')
-rw-r--r--src/layout/workspace.rs34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs
index b1afa24d..9cd2b0d3 100644
--- a/src/layout/workspace.rs
+++ b/src/layout/workspace.rs
@@ -1254,16 +1254,21 @@ impl<W: LayoutElement> Workspace<W> {
tile
}
- pub fn remove_column_by_idx(&mut self, column_idx: usize) -> Column<W> {
+ pub fn remove_column_by_idx(
+ &mut self,
+ column_idx: usize,
+ anim_config: Option<niri_config::Animation>,
+ ) -> Column<W> {
// Animate movement of the other columns.
+ let movement_config = anim_config.unwrap_or(self.options.animations.window_movement.0);
let offset = self.column_x(column_idx + 1) - self.column_x(column_idx);
if self.active_column_idx <= column_idx {
for col in &mut self.columns[column_idx + 1..] {
- col.animate_move_from(offset);
+ col.animate_move_from_with_config(offset, movement_config);
}
} else {
for col in &mut self.columns[..column_idx] {
- col.animate_move_from(-offset);
+ col.animate_move_from_with_config(-offset, movement_config);
}
}
@@ -1301,6 +1306,8 @@ impl<W: LayoutElement> Workspace<W> {
return column;
}
+ let view_config = anim_config.unwrap_or(self.options.animations.horizontal_view_movement.0);
+
if column_idx < self.active_column_idx {
// A column to the left was removed; preserve the current position.
// FIXME: preserve activate_prev_column_on_removal.
@@ -1313,16 +1320,29 @@ impl<W: LayoutElement> Workspace<W> {
if 0 < column_idx {
let prev_offset = self.activate_prev_column_on_removal.unwrap();
- self.activate_column(self.active_column_idx - 1);
+ self.activate_column_with_anim_config(self.active_column_idx - 1, view_config);
// Restore the view offset but make sure to scroll the view in case the
// previous window had resized.
let current_x = self.view_pos();
- self.animate_view_offset(current_x, self.active_column_idx, prev_offset);
- self.animate_view_offset_to_column(current_x, self.active_column_idx, None);
+ self.animate_view_offset_with_config(
+ current_x,
+ self.active_column_idx,
+ prev_offset,
+ view_config,
+ );
+ self.animate_view_offset_to_column_with_config(
+ current_x,
+ self.active_column_idx,
+ None,
+ view_config,
+ );
}
} else {
- self.activate_column(min(self.active_column_idx, self.columns.len() - 1));
+ self.activate_column_with_anim_config(
+ min(self.active_column_idx, self.columns.len() - 1),
+ view_config,
+ );
}
column