diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-08-25 08:46:34 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-08-25 08:46:34 +0300 |
| commit | 20cd4f5d0470d1755f351c53eb2c0f63c27529cf (patch) | |
| tree | 6c06dd9f2cf4adf64c94fee15a65c42faa09d0f2 /src | |
| parent | b2c7d3ad401574a3db01ed20acd67ebc8d331cbc (diff) | |
| download | niri-20cd4f5d0470d1755f351c53eb2c0f63c27529cf.tar.gz niri-20cd4f5d0470d1755f351c53eb2c0f63c27529cf.tar.bz2 niri-20cd4f5d0470d1755f351c53eb2c0f63c27529cf.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/layout/workspace.rs | 16 |
1 files changed, 16 insertions, 0 deletions
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<W: LayoutElement> Column<W> { } }; + // 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::<f64>(); + 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; |
