From befdebfa03399eeed7869fb0788d553f7aa4dcdb Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Tue, 13 Feb 2024 17:46:37 +0400 Subject: Add the beginnings of window rules --- src/layout/workspace.rs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/layout/workspace.rs') diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs index 64bc4bc7..7c9b68fc 100644 --- a/src/layout/workspace.rs +++ b/src/layout/workspace.rs @@ -321,8 +321,17 @@ impl Workspace { )) } - pub fn new_window_size(&self) -> Size { - let width = if let Some(width) = self.options.default_width { + pub fn new_window_size( + &self, + default_width: Option>, + ) -> Size { + let default_width = match default_width { + Some(Some(width)) => Some(width), + Some(None) => None, + None => self.options.default_width, + }; + + let width = if let Some(width) = default_width { let mut width = width.resolve(&self.options, self.working_area.size.w); if !self.options.border.off { width -= self.options.border.width as i32 * 2; @@ -340,8 +349,12 @@ impl Workspace { Size::from((width, max(height, 1))) } - pub fn configure_new_window(&self, window: &Window) { - let size = self.new_window_size(); + pub fn configure_new_window( + &self, + window: &Window, + default_width: Option>, + ) { + let size = self.new_window_size(default_width); let bounds = self.toplevel_bounds(); if let Some(output) = self.output.as_ref() { -- cgit