Skip to content

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

feat(domain): add `Container` getter for index in parent's child focus order

Lars Bergerb49938851846
diff --git a/GlazeWM.Domain/Containers/Container.cs b/GlazeWM.Domain/Containers/Container.cs
index debdec18..2414a7f4 100644
--- a/GlazeWM.Domain/Containers/Container.cs
+++ b/GlazeWM.Domain/Containers/Container.cs
@@ -29,6 +29,8 @@ namespace GlazeWM.Domain.Containers
if (ChildFocusOrder.Count > 0)
return ChildFocusOrder[0];
+ // TODO: Remove this conditional and instead always return
+ // `ChildFocusOrder.ElementAtOrDefault(0)`.
if (Children.Count > 0)
return Children[0];
@@ -36,6 +38,11 @@ namespace GlazeWM.Domain.Containers
}
}
+ /// <summary>
+ /// Index of this container in parent's child focus order.
+ /// </summary>
+ public int FocusIndex => Parent.ChildFocusOrder.IndexOf(this);
+
public List<Container> SelfAndSiblings => Parent.Children;
public IEnumerable<Container> Siblings
@@ -72,11 +79,6 @@ namespace GlazeWM.Domain.Containers
/// </summary>
public Container NextSibling => SelfAndSiblings.ElementAtOrDefault(Index + 1);
- /// <summary>
- /// The sibling at the previous index to this container.
- /// </summary>
- public bool IsDescendable => false;
-
/// <summary>
/// The sibling at the previous index to this container.
/// </summary>