Skip to content

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

feat(domain): add `Container` method for getting `WindowRect` with container's position/dimensions

Lars Berger66b73f733099
diff --git a/GlazeWM.Domain/Containers/Container.cs b/GlazeWM.Domain/Containers/Container.cs
index 326a3eb3..ddc0caf4 100644
--- a/GlazeWM.Domain/Containers/Container.cs
+++ b/GlazeWM.Domain/Containers/Container.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using GlazeWM.Infrastructure.WindowsApi;
namespace GlazeWM.Domain.Containers
{
@@ -113,6 +114,17 @@ namespace GlazeWM.Domain.Containers
public bool HasSiblings() => Siblings.Count() > 0;
+ public WindowRect ToRectangle()
+ {
+ return new WindowRect()
+ {
+ Left = X,
+ Right = X + Width,
+ Top = Y,
+ Bottom = Y + Height,
+ };
+ }
+
public IEnumerable<Container> ChildrenOfType(Type type)
{
return Children.Where(container => type.IsAssignableFrom(container.GetType()));