Skip to content

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

feat(domain): handle parsing of "exit wm" command string

Lars Berger8cfe3050dcc4
diff --git a/GlazeWM.Domain/UserConfigs/CommandParsingService.cs b/GlazeWM.Domain/UserConfigs/CommandParsingService.cs
index cb384536..cc956c99 100644
--- a/GlazeWM.Domain/UserConfigs/CommandParsingService.cs
+++ b/GlazeWM.Domain/UserConfigs/CommandParsingService.cs
@@ -1,5 +1,6 @@
using System;
using System.Text.RegularExpressions;
+using GlazeWM.Domain.Common.Commands;
using GlazeWM.Domain.Common.Enums;
using GlazeWM.Domain.Containers.Commands;
using GlazeWM.Domain.Windows.Commands;
@@ -37,6 +38,7 @@ namespace GlazeWM.Domain.UserConfigs
"move" => ParseMoveCommand(commandParts),
"resize" => ParseResizeCommand(commandParts),
"toggle" => ParseToggleCommand(commandParts),
+ "exit" => ParseExitCommand(commandParts),
"close" => new CloseFocusedWindowCommand(),
_ => throw new ArgumentException(),
};
@@ -107,6 +109,15 @@ namespace GlazeWM.Domain.UserConfigs
};
}
+ private Command ParseExitCommand(string[] commandParts)
+ {
+ return commandParts[1] switch
+ {
+ "wm" => new ExitApplicationCommand(),
+ _ => throw new ArgumentException(),
+ };
+ }
+
/// <summary>
/// Checks whether a workspace exists with the given name.
/// </summary>