From 20cd4f5d0470d1755f351c53eb2c0f63c27529cf Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sun, 25 Aug 2024 08:46:34 +0300 Subject: layout: Clamp window height to max available in column When the window is alone in its column this logic intentionally isn't triggered. Until we have a floating layer, there's no other way to get a window larger than the screen, which I need. --- src/layout/workspace.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/layout') diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs index 272a153b..defa7c3f 100644 --- a/src/layout/workspace.rs +++ b/src/layout/workspace.rs @@ -3484,6 +3484,22 @@ impl Column { } }; + // If there are multiple windows in a column, clamp the height according to other windows' + // min sizes. + let min_height_taken = self + .tiles + .iter() + .enumerate() + .filter(|(idx, _)| *idx != tile_idx) + .map(|(_, tile)| f64::max(1., tile.min_size().h) + self.options.gaps) + .sum::(); + if min_height_taken > 0. { + let height_left = + self.working_area.size.h - self.options.gaps - min_height_taken - self.options.gaps; + let height_left = f64::max(1., tile.window_height_for_tile_height(height_left)); + window_height = f64::min(height_left, window_height); + } + // Clamp it against the window height constraints. let win = &self.tiles[tile_idx].window(); let min_h = win.min_size().h; -- cgit