aboutsummaryrefslogtreecommitdiff
path: root/src/layout/mod.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2025-09-20 12:57:41 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2025-10-02 09:33:08 +0300
commit1fa9dd32ed028c88248644a13421c098fef72894 (patch)
treee6ea60b5b0b7ebc390ecc623b091bbe3dc40fdf0 /src/layout/mod.rs
parent2781d3a74338806f631acda99e9f702b1b59a3e6 (diff)
downloadniri-1fa9dd32ed028c88248644a13421c098fef72894.tar.gz
niri-1fa9dd32ed028c88248644a13421c098fef72894.tar.bz2
niri-1fa9dd32ed028c88248644a13421c098fef72894.zip
config: Split Layout from LayoutPart
Diffstat (limited to 'src/layout/mod.rs')
-rw-r--r--src/layout/mod.rs24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index c7d8a6fd..40f1deed 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -40,8 +40,8 @@ use std::time::Duration;
use monitor::{InsertHint, InsertPosition, InsertWorkspace, MonitorAddWindowTarget};
use niri_config::utils::MergeWith as _;
use niri_config::{
- CenterFocusedColumn, Config, CornerRadius, FloatOrInt, PresetSize, Struts,
- Workspace as WorkspaceConfig, WorkspaceReference,
+ CenterFocusedColumn, Config, CornerRadius, PresetSize, Struts, Workspace as WorkspaceConfig,
+ WorkspaceReference,
};
use niri_ipc::{ColumnDisplay, PositionChange, SizeChange, WindowLayout};
use scrolling::{Column, ColumnWidth};
@@ -620,7 +620,7 @@ impl HitType {
impl Options {
fn from_config(config: &Config) -> Self {
- let layout = &config.layout;
+ let layout = config.resolve_layout();
let preset_column_widths = if layout.preset_column_widths.is_empty() {
Options::default().preset_column_widths
@@ -633,16 +633,8 @@ impl Options {
layout.preset_window_heights.clone()
};
- // Missing default_column_width maps to Some(PresetSize::Proportion(0.5)),
- // while present, but empty, maps to None.
- let default_column_width = layout
- .default_column_width
- .as_ref()
- .map(|w| w.0)
- .unwrap_or(Some(PresetSize::Proportion(0.5)));
-
Self {
- gaps: layout.gaps.0,
+ gaps: layout.gaps,
struts: layout.struts,
focus_ring: layout.focus_ring,
border: layout.border,
@@ -654,7 +646,7 @@ impl Options {
empty_workspace_above_first: layout.empty_workspace_above_first,
default_column_display: layout.default_column_display,
preset_column_widths,
- default_column_width,
+ default_column_width: layout.default_column_width,
animations: config.animations.clone(),
gestures: config.gestures,
overview: config.overview,
@@ -669,8 +661,8 @@ impl Options {
let round = |logical: f64| round_logical_in_physical_max1(scale, logical);
self.gaps = round(self.gaps);
- self.focus_ring.width = FloatOrInt(round(self.focus_ring.width.0));
- self.border.width = FloatOrInt(round(self.border.width.0));
+ self.focus_ring.width = round(self.focus_ring.width);
+ self.border.width = round(self.border.width);
self
}
@@ -5252,7 +5244,7 @@ impl<W: LayoutElement> Layout<W> {
let rules = window.rules();
let border = self.options.border.merged_with(&rules.border);
if !border.off {
- fixed += border.width.0 * 2.;
+ fixed += border.width * 2.;
}
ColumnWidth::Fixed(fixed)