Add center-window by-id action

This commit is contained in:
Ivan Molodetskikh
2024-12-29 22:44:19 +03:00
parent 6cb5135f34
commit 6c897d5201
7 changed files with 88 additions and 4 deletions
+11 -1
View File
@@ -971,12 +971,22 @@ impl<W: LayoutElement> Workspace<W> {
pub fn center_column(&mut self) {
if self.floating_is_active.get() {
self.floating.center_window();
self.floating.center_window(None);
} else {
self.scrolling.center_column();
}
}
pub fn center_window(&mut self, id: Option<&W::Id>) {
if id.map_or(self.floating_is_active.get(), |id| {
self.floating.has_window(id)
}) {
self.floating.center_window(id);
} else {
self.scrolling.center_window(id);
}
}
pub fn toggle_width(&mut self) {
if self.floating_is_active.get() {
self.floating.toggle_window_width(None);