From f3075efcae05734bfebaa09044654976f7479437 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sat, 1 Feb 2025 20:02:46 -0800 Subject: [PATCH] fix(wm): always preserve resize on monocle toggle This commit ensures that the Vec of resize adjustment Rects will never be truncated when monocle mode is enabled for a container. fix #1257 --- komorebi/src/workspace.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/komorebi/src/workspace.rs b/komorebi/src/workspace.rs index 2df2e323..79f326f5 100644 --- a/komorebi/src/workspace.rs +++ b/komorebi/src/workspace.rs @@ -458,7 +458,16 @@ impl Workspace { // number of layouts / containers. This should never actually truncate as the remove_window // function takes care of cleaning up resize dimensions when destroying empty containers let container_count = self.containers().len(); - self.resize_dimensions_mut().resize(container_count, None); + + // since monocle is a toggle, we never want to truncate the resize dimensions since it will + // almost always be toggled off and the container will be reintegrated into layout + // + // without this check, if there are exactly two containers, when one is toggled to monocle + // the resize dimensions will be truncated to len == 1, and when it is reintegrated, if it + // had a resize adjustment before, that will have been lost + if self.monocle_container().is_none() { + self.resize_dimensions_mut().resize(container_count, None); + } Ok(()) }