Skip to content

GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.

fix(domain): prevent crash if `Bar` or `Gaps` is not present in user config

Lars Berger097185a2192f
diff --git a/GlazeWM.Domain/UserConfigs/BarConfig.cs b/GlazeWM.Domain/UserConfigs/BarConfig.cs
index 13870262..6d8ac9b1 100644
--- a/GlazeWM.Domain/UserConfigs/BarConfig.cs
+++ b/GlazeWM.Domain/UserConfigs/BarConfig.cs
@@ -2,7 +2,7 @@ namespace GlazeWM.Domain.UserConfigs
{
public class BarConfig
{
- public int Height { get; set; } = 25;
+ public uint Height { get; set; } = 25;
public string Background { get; set; } = "#101010";
public string FontFamily { get; set; } = "Segoe UI";
public string FontSize { get; set; } = "12";
diff --git a/GlazeWM.Domain/UserConfigs/SampleUserConfig.yaml b/GlazeWM.Domain/UserConfigs/SampleUserConfig.yaml
index 4680f6d9..d4b80815 100644
--- a/GlazeWM.Domain/UserConfigs/SampleUserConfig.yaml
+++ b/GlazeWM.Domain/UserConfigs/SampleUserConfig.yaml
@@ -6,7 +6,7 @@ Gaps:
OuterGap: 20
Bar:
- Height: 50
+ Height: 25
Workspaces:
- Name: 1
diff --git a/GlazeWM.Domain/UserConfigs/UserConfig.cs b/GlazeWM.Domain/UserConfigs/UserConfig.cs
index f016a965..eeae3eb0 100644
--- a/GlazeWM.Domain/UserConfigs/UserConfig.cs
+++ b/GlazeWM.Domain/UserConfigs/UserConfig.cs
@@ -16,9 +16,9 @@ namespace GlazeWM.Domain.UserConfigs
/// </summary>
public double ResizeProportion => ResizePercentage / 100;
- public GapsConfig Gaps { get; set; }
+ public GapsConfig Gaps { get; set; } = new GapsConfig();
- public BarConfig Bar { get; set; }
+ public BarConfig Bar { get; set; } = new BarConfig();
public List<WorkspaceConfig> Workspaces = new List<WorkspaceConfig>();