From f5b776a9471b20f795823f8343a1ac24f5df4c1e Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Fri, 23 Feb 2024 14:31:35 +0400 Subject: Fix unset default width causing a window resize right away --- src/layout/mod.rs | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'src/layout') diff --git a/src/layout/mod.rs b/src/layout/mod.rs index c7239a2b..4fc8021a 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -534,7 +534,13 @@ impl Layout { width: Option, is_full_width: bool, ) -> Option<&Output> { - let width = width.unwrap_or_else(|| ColumnWidth::Fixed(window.size().w)); + let width = width.unwrap_or_else(|| { + let mut width = window.size().w; + if !self.options.border.off { + width += self.options.border.width as i32 * 2; + } + ColumnWidth::Fixed(width) + }); match &mut self.monitor_set { MonitorSet::Normal { @@ -585,7 +591,13 @@ impl Layout { width: Option, is_full_width: bool, ) -> Option<&Output> { - let width = width.unwrap_or_else(|| ColumnWidth::Fixed(window.size().w)); + let width = width.unwrap_or_else(|| { + let mut width = window.size().w; + if !self.options.border.off { + width += self.options.border.width as i32 * 2; + } + ColumnWidth::Fixed(width) + }); match &mut self.monitor_set { MonitorSet::Normal { monitors, .. } => { @@ -616,7 +628,13 @@ impl Layout { width: Option, is_full_width: bool, ) { - let width = width.unwrap_or_else(|| ColumnWidth::Fixed(window.size().w)); + let width = width.unwrap_or_else(|| { + let mut width = window.size().w; + if !self.options.border.off { + width += self.options.border.width as i32 * 2; + } + ColumnWidth::Fixed(width) + }); let MonitorSet::Normal { monitors, -- cgit