Skip to content

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

feat(domain): add `Window` getters for siblings of a specified mode

Lars Berger59adb5334465
diff --git a/GlazeWM.Domain/Windows/Window.cs b/GlazeWM.Domain/Windows/Window.cs
index da88d85d..bf6c0ce9 100644
--- a/GlazeWM.Domain/Windows/Window.cs
+++ b/GlazeWM.Domain/Windows/Window.cs
@@ -1,5 +1,7 @@
-using System;
+using System;
+using System.Collections.Generic;
using System.Diagnostics;
+using System.Linq;
using GlazeWM.Domain.Containers;
using GlazeWM.Domain.Workspaces;
using GlazeWM.Infrastructure;
@@ -66,5 +68,22 @@ namespace GlazeWM.Domain.Windows
{
return _windowService.HandleHasWindowExStyle(Hwnd, style);
}
+
+ public IEnumerable<Container> SelfAndSiblingWithMode(WindowMode mode)
+ {
+ return SelfAndSiblings.Where(container => (container as Window)?.Mode == mode);
+ }
+
+ public Container GetNextSiblingWithMode(WindowMode mode)
+ {
+ return SelfAndSiblings
+ .Skip(Index)
+ .FirstOrDefault(container => (container as Window)?.Mode == mode);
+ }
+
+ public Container GetPreviousSiblingWithMode(WindowMode mode)
+ {
+ throw new NotImplementedException();
+ }
}
}