diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-12-29 22:44:19 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-12-30 20:12:37 +0300 |
| commit | 6c897d520165bfcaf3833b6e3d4bdbd836d26063 (patch) | |
| tree | 29fa7697f53facfe8bca4d12cbff1cca7e9065e7 /src/layout/floating.rs | |
| parent | 6cb5135f3477e63ed1738e19ba95a07ce52093ae (diff) | |
| download | niri-6c897d520165bfcaf3833b6e3d4bdbd836d26063.tar.gz niri-6c897d520165bfcaf3833b6e3d4bdbd836d26063.tar.bz2 niri-6c897d520165bfcaf3833b6e3d4bdbd836d26063.zip | |
Add center-window by-id action
Diffstat (limited to 'src/layout/floating.rs')
| -rw-r--r-- | src/layout/floating.rs | 6 |
1 files changed, 3 insertions, 3 deletions
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<W: LayoutElement> FloatingSpace<W> { 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); |
