GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
feat(domain): partially implement moving container to start/end of ancestor in `MoveFocusedWindowHandler`
Lars Berger1aed414678c6
diff --git a/LarsWM.Domain/Windows/CommandHandlers/MoveFocusedWindowHandler.cs b/LarsWM.Domain/Windows/CommandHandlers/MoveFocusedWindowHandler.csindex 6b581703..b82da349 100644--- a/LarsWM.Domain/Windows/CommandHandlers/MoveFocusedWindowHandler.cs+++ b/LarsWM.Domain/Windows/CommandHandlers/MoveFocusedWindowHandler.cs@@ -33,7 +33,9 @@ namespace LarsWM.Domain.Windows.CommandHandlersvar layoutForDirection = (direction == Direction.LEFT || direction == Direction.RIGHT)? Layout.Horizontal : Layout.Vertical;- var ancestorWithLayout = focusedWindow.TraverseUpEnumeration().Where(con => (con as SplitContainer)?.Layout == layoutForDirection).FirstOrDefault();+ var ancestorWithLayout = focusedWindow.TraverseUpEnumeration()+ .Where(container => (container as SplitContainer)?.Layout == layoutForDirection)+ .FirstOrDefault() as SplitContainer;// Change the layout of the workspace to `layoutForDirection`.if (ancestorWithLayout == null)@@ -62,6 +64,17 @@ namespace LarsWM.Domain.Windows.CommandHandlersreturn CommandResponse.Ok;}+ // Insert container into `ancestorWithLayout` at start or end.+ // TODO: Should actually traverse up from `focusedWindow` to find container where the parent+ // is `ancestorWithLayout`. Then, depending on direction, insert before or after that container.+ // TODO: Consider changing `InsertPosition` to an int, and set the default to `Siblings.Count - 1`.+ if (direction == Direction.UP || direction == Direction.LEFT)+ _bus.Invoke(new AttachContainerCommand(ancestorWithLayout, focusedWindow));+ else+ _bus.Invoke(new AttachContainerCommand(ancestorWithLayout, focusedWindow, InsertPosition.START));++ _bus.Invoke(new RedrawContainersCommand());+return CommandResponse.Ok;}}