Skip to content

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

feat(domain): add `Container` getter for its children of a given type

Lars Bergerb91cd67a5dc2
diff --git a/GlazeWM.Domain/Containers/Container.cs b/GlazeWM.Domain/Containers/Container.cs
index 92c27682..8f57731d 100644
--- a/GlazeWM.Domain/Containers/Container.cs
+++ b/GlazeWM.Domain/Containers/Container.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
@@ -89,6 +89,11 @@ namespace GlazeWM.Domain.Containers
public bool HasSiblings() => Siblings.Count() > 0;
+ public IEnumerable<Container> ChildrenOfType(Type type)
+ {
+ return Children.Where(container => type.IsAssignableFrom(container.GetType()));
+ }
+
public IEnumerable<Container> SelfAndSiblingsOfType(Type type)
{
return SelfAndSiblings.Where(container => type.IsAssignableFrom(container.GetType()));