Skip to content

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

fix(domain): use correct target index when swapping sibling windows on move

Lars Bergera81875aabe92
diff --git a/GlazeWM.Domain/Windows/CommandHandlers/MoveFocusedWindowHandler.cs b/GlazeWM.Domain/Windows/CommandHandlers/MoveFocusedWindowHandler.cs
index 6c80217a..66f8bbec 100644
--- a/GlazeWM.Domain/Windows/CommandHandlers/MoveFocusedWindowHandler.cs
+++ b/GlazeWM.Domain/Windows/CommandHandlers/MoveFocusedWindowHandler.cs
@@ -88,14 +88,18 @@ namespace GlazeWM.Domain.Windows.CommandHandlers
// Swap the focused window with sibling in given direction.
if (siblingInDirection is Window)
{
+ var targetIndex = direction == Direction.UP || direction == Direction.LEFT ?
+ siblingInDirection.Index : siblingInDirection.Index + 1;
+
_bus.Invoke(
new MoveContainerWithinTreeCommand(
focusedWindow,
focusedWindow.Parent,
- siblingInDirection.Index,
+ targetIndex,
false
)
);
+
_bus.Invoke(new RedrawContainersCommand());
return;
}