Skip to content

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

feat: allow `inner_gap` to be specified with or without px suffix (#373)

blam43cdc8a561ef
diff --git a/GlazeWM.App/Resources/sample-config.yaml b/GlazeWM.App/Resources/sample-config.yaml
index 5e95fd5a..bce40742 100644
--- a/GlazeWM.App/Resources/sample-config.yaml
+++ b/GlazeWM.App/Resources/sample-config.yaml
@@ -1,5 +1,5 @@
gaps:
- inner_gap: 20
+ inner_gap: "20px"
outer_gap: 20
# Only supported for Windows 11 Build 22000.51 and above.
diff --git a/GlazeWM.Domain/Containers/ContainerService.cs b/GlazeWM.Domain/Containers/ContainerService.cs
index 20514823..6bbd7d32 100644
--- a/GlazeWM.Domain/Containers/ContainerService.cs
+++ b/GlazeWM.Domain/Containers/ContainerService.cs
@@ -4,6 +4,7 @@ using System.Linq;
using GlazeWM.Domain.Common.Enums;
using GlazeWM.Domain.UserConfigs;
using GlazeWM.Domain.Windows;
+using GlazeWM.Infrastructure.Utils;
namespace GlazeWM.Domain.Containers
{
@@ -67,7 +68,7 @@ namespace GlazeWM.Domain.Containers
if (parent.TilingDirection == TilingDirection.Vertical)
return parent.Width;
- var innerGap = _userConfigService.GapsConfig.InnerGap;
+ var innerGap = UnitsHelper.TrimUnits(_userConfigService.GapsConfig.InnerGap);
var resizableSiblings = container.SelfAndSiblingsOfType<IResizable>();
return (int)((container as IResizable).SizePercentage
@@ -85,7 +86,7 @@ namespace GlazeWM.Domain.Containers
if (parent.TilingDirection == TilingDirection.Horizontal)
return parent.Height;
- var innerGap = _userConfigService.GapsConfig.InnerGap;
+ var innerGap = UnitsHelper.TrimUnits(_userConfigService.GapsConfig.InnerGap);
var resizableSiblings = container.SelfAndSiblingsOfType<IResizable>();
return (int)((container as IResizable).SizePercentage
@@ -105,7 +106,7 @@ namespace GlazeWM.Domain.Containers
if (parent.TilingDirection == TilingDirection.Vertical || isFirstOfType)
return parent.X;
- var innerGap = _userConfigService.GapsConfig.InnerGap;
+ var innerGap = UnitsHelper.TrimUnits(_userConfigService.GapsConfig.InnerGap);
return container.PreviousSiblingOfType<IResizable>().X
+ container.PreviousSiblingOfType<IResizable>().Width
@@ -125,7 +126,7 @@ namespace GlazeWM.Domain.Containers
if (parent.TilingDirection == TilingDirection.Horizontal || isFirstOfType)
return parent.Y;
- var innerGap = _userConfigService.GapsConfig.InnerGap;
+ var innerGap = UnitsHelper.TrimUnits(_userConfigService.GapsConfig.InnerGap);
return container.PreviousSiblingOfType<IResizable>().Y
+ container.PreviousSiblingOfType<IResizable>().Height
diff --git a/GlazeWM.Domain/UserConfigs/GapsConfig.cs b/GlazeWM.Domain/UserConfigs/GapsConfig.cs
index 0d964be1..d7f4308d 100644
--- a/GlazeWM.Domain/UserConfigs/GapsConfig.cs
+++ b/GlazeWM.Domain/UserConfigs/GapsConfig.cs
@@ -2,7 +2,7 @@ namespace GlazeWM.Domain.UserConfigs
{
public class GapsConfig
{
- public int InnerGap { get; set; } = 20;
+ public string InnerGap { get; set; } = "20px";
public string OuterGap { get; set; } = "20px";
}
}
diff --git a/README.md b/README.md
index cdc8a1ac..04554c98 100644
--- a/README.md
+++ b/README.md
@@ -122,7 +122,7 @@ The gaps between windows can be changed via the `gaps` property in the config fi
```yaml
gaps:
# Gap between adjacent windows.
- inner_gap: 20
+ inner_gap: "20px"
# Gap between windows and the screen edge. See "Shorthand properties" for more info.
outer_gap: "20px 0 20px 0"