Skip to content

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

feat(boot,domain): add alias for "layout <horizontal|vertical>" -> "tiling direction <horizontal|vertical>"

Lars Berger9bf1a1d64aae
diff --git a/GlazeWM.Bootstrapper/sample-config.yaml b/GlazeWM.Bootstrapper/sample-config.yaml
index 4a2d61a8..cdac13f3 100644
--- a/GlazeWM.Bootstrapper/sample-config.yaml
+++ b/GlazeWM.Bootstrapper/sample-config.yaml
@@ -96,10 +96,10 @@ keybindings:
- command: "binding mode resize"
binding: "Alt+R"
- # Change layout direction to be either horizontal or vertical.
- - command: "layout horizontal"
+ # Change tiling direction. This determines where new tiling windows will be inserted.
+ - command: "tiling direction horizontal"
binding: "Alt+Shift+V"
- - command: "layout vertical"
+ - command: "tiling direction vertical"
binding: "Alt+V"
# Change focus between floating / tiling windows.
diff --git a/GlazeWM.Domain/UserConfigs/CommandParsingService.cs b/GlazeWM.Domain/UserConfigs/CommandParsingService.cs
index f5673aec..320e9f5a 100644
--- a/GlazeWM.Domain/UserConfigs/CommandParsingService.cs
+++ b/GlazeWM.Domain/UserConfigs/CommandParsingService.cs
@@ -72,6 +72,8 @@ namespace GlazeWM.Domain.UserConfigs
return commandParts[0] switch
{
+ "tiling" => ParseTilingCommand(commandParts, subjectContainer),
+ // TODO: "layout <LAYOUT>" commands are deprecated. Remove in next major release.
"layout" => ParseLayoutCommand(commandParts, subjectContainer),
"focus" => ParseFocusCommand(commandParts),
"move" => ParseMoveCommand(commandParts, subjectContainer),
@@ -95,6 +97,20 @@ namespace GlazeWM.Domain.UserConfigs
};
}
+ private static Command ParseTilingCommand(string[] commandParts, Container subjectContainer)
+ {
+ return commandParts[1] switch
+ {
+ "direction" => commandParts[2] switch
+ {
+ "vertical" => new ChangeContainerLayoutCommand(subjectContainer, Layout.VERTICAL),
+ "horizontal" => new ChangeContainerLayoutCommand(subjectContainer, Layout.HORIZONTAL),
+ _ => throw new ArgumentException(null, nameof(commandParts)),
+ },
+ _ => throw new ArgumentException(null, nameof(commandParts)),
+ };
+ }
+
private static Command ParseLayoutCommand(string[] commandParts, Container subjectContainer)
{
return commandParts[1] switch