GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
feat(domain): invoke window rule commands when a window is added
Lars Bergerd071657f1435
diff --git a/LarsWM.Domain/Windows/CommandHandlers/AddWindowHandler.cs b/LarsWM.Domain/Windows/CommandHandlers/AddWindowHandler.csindex a26ab83f..71bee981 100644--- a/LarsWM.Domain/Windows/CommandHandlers/AddWindowHandler.cs+++ b/LarsWM.Domain/Windows/CommandHandlers/AddWindowHandler.cs@@ -1,4 +1,4 @@-using System.Collections.Generic;+using System.Collections.Generic;using System.Linq;using System.Text.RegularExpressions;using LarsWM.Domain.Containers;@@ -43,6 +43,7 @@ namespace LarsWM.Domain.Windows.CommandHandlers.SelectMany(rule => rule.CommandStrings).Select(commandString => _commandParsingService.FormatCommand(commandString));+ // Avoid managing a window if a window rule uses 'ignore' command.if (commandStrings.Contains("ignore"))return CommandResponse.Ok;@@ -58,11 +59,17 @@ namespace LarsWM.Domain.Windows.CommandHandlersfocusedContainer.Parent as SplitContainer, window, focusedContainer.Index + 1));- _bus.Invoke(new RedrawContainersCommand());-// Set focus to newly added window in case it has not been focused automatically._bus.Invoke(new FocusWindowCommand(window));+ var parsedCommands = commandStrings+ .Select(commandString => _commandParsingService.ParseCommand(commandString));++ foreach (var parsedCommand in parsedCommands)+ _bus.Invoke((dynamic)parsedCommand);++ _bus.Invoke(new RedrawContainersCommand());+return CommandResponse.Ok;}