Skip to content

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

feat: added method for calculating window positions when forcing initial layout

Larsd3e9bd4b9fd8
diff --git a/LarsWM/LayoutService.cs b/LarsWM/LayoutService.cs
index f714ec3a..fc48368e 100644
--- a/LarsWM/LayoutService.cs
+++ b/LarsWM/LayoutService.cs
@@ -1,14 +1,28 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Text;
namespace LarsWM
{
class LayoutService
{
- public void CalculateInitialLayout()
+ public static List<WindowLocation> CalculateInitialLayout(Monitor monitor, List<Window> windows)
{
-
+ var windowLocations = new List<WindowLocation>();
+
+ //var windowWidth = (monitor.Width - UserConfig.UserConfigService.InnerGap) / windows.Count;
+ var windowWidth = (monitor.Width) / windows.Count();
+
+ var index = 1;
+ foreach(var window in windows)
+ {
+ var newWindowLocation = new WindowLocation(index * windowWidth, 0, windowWidth, monitor.Height);
+ windowLocations.Add(newWindowLocation);
+ index++;
+ }
+
+ return windowLocations;
}
}
}