From 6c897d520165bfcaf3833b6e3d4bdbd836d26063 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sun, 29 Dec 2024 22:44:19 +0300 Subject: Add center-window by-id action --- src/layout/floating.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/layout/floating.rs') diff --git a/src/layout/floating.rs b/src/layout/floating.rs index 6192d119..5302e158 100644 --- a/src/layout/floating.rs +++ b/src/layout/floating.rs @@ -902,11 +902,11 @@ impl FloatingSpace { self.move_to(idx, new_pos, animate); } - pub fn center_window(&mut self) { - let Some(active_id) = &self.active_window_id else { + pub fn center_window(&mut self, id: Option<&W::Id>) { + let Some(id) = id.or(self.active_window_id.as_ref()).cloned() else { return; }; - let idx = self.idx_of(active_id).unwrap(); + let idx = self.idx_of(&id).unwrap(); let new_pos = center_preferring_top_left_in_area(self.working_area, self.data[idx].size); self.move_to(idx, new_pos, true); -- cgit