Skip to content

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

feat: outer gaps supports multiple values (#282)

Max Lefebvreb9e792bbda13
diff --git a/GlazeWM.Domain/UserConfigs/CommandParsingService.cs b/GlazeWM.Domain/UserConfigs/CommandParsingService.cs
index dc7428ef..eb569414 100644
--- a/GlazeWM.Domain/UserConfigs/CommandParsingService.cs
+++ b/GlazeWM.Domain/UserConfigs/CommandParsingService.cs
@@ -328,7 +328,7 @@ namespace GlazeWM.Domain.UserConfigs
return args.Where(arg => !string.IsNullOrWhiteSpace(arg)).ToList();
}
- private static RectDelta ShorthandToRectDelta(string shorthand)
+ public static RectDelta ShorthandToRectDelta(string shorthand)
{
var shorthandParts = shorthand.Split(" ")
.Select(shorthandPart => UnitsHelper.TrimUnits(shorthandPart))
diff --git a/GlazeWM.Domain/UserConfigs/GapsConfig.cs b/GlazeWM.Domain/UserConfigs/GapsConfig.cs
index 456174e5..0d964be1 100644
--- a/GlazeWM.Domain/UserConfigs/GapsConfig.cs
+++ b/GlazeWM.Domain/UserConfigs/GapsConfig.cs
@@ -3,6 +3,6 @@ namespace GlazeWM.Domain.UserConfigs
public class GapsConfig
{
public int InnerGap { get; set; } = 20;
- public int OuterGap { get; set; } = 20;
+ public string OuterGap { get; set; } = "20px";
}
}
diff --git a/GlazeWM.Domain/Workspaces/Workspace.cs b/GlazeWM.Domain/Workspaces/Workspace.cs
index 3babbab4..9913aad3 100644
--- a/GlazeWM.Domain/Workspaces/Workspace.cs
+++ b/GlazeWM.Domain/Workspaces/Workspace.cs
@@ -5,6 +5,7 @@ using GlazeWM.Domain.Monitors;
using GlazeWM.Domain.UserConfigs;
using GlazeWM.Infrastructure;
using GlazeWM.Infrastructure.Utils;
+using GlazeWM.Infrastructure.WindowsApi;
namespace GlazeWM.Domain.Workspaces
{
@@ -46,7 +47,7 @@ namespace GlazeWM.Domain.Workspaces
}
}
- private int _outerGap => _userConfigService.GapsConfig.OuterGap;
+ private RectDelta _outerGaps => CommandParsingService.ShorthandToRectDelta(_userConfigService.GapsConfig.OuterGap);
private BarConfig barForMonitor => _userConfigService.GetBarConfigForMonitor(Parent as Monitor);
private int floatBarOffsetY => UnitsHelper.TrimUnits(barForMonitor.OffsetY);
@@ -57,25 +58,25 @@ namespace GlazeWM.Domain.Workspaces
{
if (!_userConfigService.GetBarConfigForMonitor(Parent as Monitor).Enabled)
{
- return Parent.Height - (_outerGap * 2);
+ return Parent.Height - _outerGaps.Top - _outerGaps.Bottom;
}
- return Parent.Height - (_outerGap * 2) - floatBarOffsetY - _logicalBarHeight;
+ return Parent.Height - _outerGaps.Top - _outerGaps.Bottom - floatBarOffsetY - _logicalBarHeight;
}
}
- public override int Width => Parent.Width - (_outerGap * 2);
- public override int X => Parent.X + _outerGap;
+ public override int Width => Parent.Width - _outerGaps.Left - _outerGaps.Right;
+ public override int X => Parent.X + _outerGaps.Left;
public override int Y
{
get
{
if (!_userConfigService.GetBarConfigForMonitor(Parent as Monitor).Enabled)
{
- return Parent.Y + _outerGap;
+ return Parent.Y + _outerGaps.Top;
}
- return Parent.Y + _outerGap + _yOffset + floatBarOffsetY;
+ return Parent.Y + _outerGaps.Top + _yOffset + floatBarOffsetY;
}
}
diff --git a/README.md b/README.md
index 77b2f63c..4da40942 100644
--- a/README.md
+++ b/README.md
@@ -124,8 +124,8 @@ gaps:
# Gap between adjacent windows.
inner_gap: 20
- # Gap between windows and the screen edge.
- outer_gap: 20
+ # Gap between windows and the screen edge. See "Shorthand properties" for more info.
+ outer_gap: "20px 0 20px 0"
```
## Workspaces configuration