diff --git a/komorebi-core/src/custom_layout.rs b/komorebi-core/src/custom_layout.rs index 0c7eeee4b..26b5991da 100644 --- a/komorebi-core/src/custom_layout.rs +++ b/komorebi-core/src/custom_layout.rs @@ -72,7 +72,7 @@ impl CustomLayout { } #[must_use] - pub fn primary_width_percentage(&self) -> Option { + pub fn primary_width_percentage(&self) -> Option { for column in self.iter() { if let Column::Primary(Option::Some(ColumnWidth::WidthPercentage(percentage))) = column { @@ -83,7 +83,7 @@ impl CustomLayout { None } - pub fn set_primary_width_percentage(&mut self, percentage: usize) { + pub fn set_primary_width_percentage(&mut self, percentage: f32) { for column in self.iter_mut() { if let Column::Primary(Option::Some(ColumnWidth::WidthPercentage(current))) = column { *current = percentage; @@ -262,7 +262,7 @@ pub enum Column { #[derive(Clone, Copy, Debug, Serialize, Deserialize, JsonSchema)] pub enum ColumnWidth { - WidthPercentage(usize), + WidthPercentage(f32), } #[derive(Clone, Copy, Debug, Serialize, Deserialize, JsonSchema)] diff --git a/komorebi/src/process_command.rs b/komorebi/src/process_command.rs index 1a30547b4..4b59335a4 100644 --- a/komorebi/src/process_command.rs +++ b/komorebi/src/process_command.rs @@ -683,15 +683,15 @@ impl WindowManager { if matches!(axis, Axis::Horizontal) { let percentage = custom .primary_width_percentage() - .unwrap_or(100 / custom.len()); + .unwrap_or(100.0 / (custom.len() as f32)); if no_layout_rules { match sizing { Sizing::Increase => { - custom.set_primary_width_percentage(percentage + 5); + custom.set_primary_width_percentage(percentage + 5.0); } Sizing::Decrease => { - custom.set_primary_width_percentage(percentage - 5); + custom.set_primary_width_percentage(percentage - 5.0); } } } else { @@ -700,10 +700,10 @@ impl WindowManager { if let Layout::Custom(ref mut custom) = rule.1 { match sizing { Sizing::Increase => { - custom.set_primary_width_percentage(percentage + 5); + custom.set_primary_width_percentage(percentage + 5.0); } Sizing::Decrease => { - custom.set_primary_width_percentage(percentage - 5); + custom.set_primary_width_percentage(percentage - 5.0); } } }