config: Fix missing layout {} defaulting to 0 gaps
Browse files at this commit7960a73e9dda9f82c67e2f7b37766c88f5889c14Parent: 749ee5d1 changed file +16 -2
- niri-config/src/lib.rs +16 -2
niri-config/src/lib.rsmodified+16 -2
| @@ -277,7 +277,7 @@ pub struct Mode { | |||
| 277 | pub refresh: Option<f64>, | 277 | pub refresh: Option<f64>, |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | -#[derive(knuffel::Decode, Debug, Default, Clone, PartialEq)] | 280 | +#[derive(knuffel::Decode, Debug, Clone, PartialEq)] |
| 281 | pub struct Layout { | 281 | pub struct Layout { |
| 282 | #[knuffel(child, default)] | 282 | #[knuffel(child, default)] |
| 283 | pub focus_ring: FocusRing, | 283 | pub focus_ring: FocusRing, |
| @@ -289,12 +289,26 @@ pub struct Layout { | |||
| 289 | pub default_column_width: Option<DefaultColumnWidth>, | 289 | pub default_column_width: Option<DefaultColumnWidth>, |
| 290 | #[knuffel(child, unwrap(argument), default)] | 290 | #[knuffel(child, unwrap(argument), default)] |
| 291 | pub center_focused_column: CenterFocusedColumn, | 291 | pub center_focused_column: CenterFocusedColumn, |
| 292 | - #[knuffel(child, unwrap(argument), default = 16)] | 292 | + #[knuffel(child, unwrap(argument), default = Self::default().gaps)] |
| 293 | pub gaps: u16, | 293 | pub gaps: u16, |
| 294 | #[knuffel(child, default)] | 294 | #[knuffel(child, default)] |
| 295 | pub struts: Struts, | 295 | pub struts: Struts, |
| 296 | } | 296 | } |
| 297 | 297 | ||
| 298 | +impl Default for Layout { | ||
| 299 | + fn default() -> Self { | ||
| 300 | + Self { | ||
| 301 | + focus_ring: Default::default(), | ||
| 302 | + border: Default::default(), | ||
| 303 | + preset_column_widths: Default::default(), | ||
| 304 | + default_column_width: Default::default(), | ||
| 305 | + center_focused_column: Default::default(), | ||
| 306 | + gaps: 16, | ||
| 307 | + struts: Default::default(), | ||
| 308 | + } | ||
| 309 | + } | ||
| 310 | +} | ||
| 311 | + | ||
| 298 | #[derive(knuffel::Decode, Debug, Clone, PartialEq, Eq)] | 312 | #[derive(knuffel::Decode, Debug, Clone, PartialEq, Eq)] |
| 299 | pub struct SpawnAtStartup { | 313 | pub struct SpawnAtStartup { |
| 300 | #[knuffel(arguments)] | 314 | #[knuffel(arguments)] |