GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
feat: default to vertical tiling for workspaces on vertical monitors (#211)
blam3ba37c4eaba1
diff --git a/GlazeWM.Domain/Containers/JsonContainerConverter.cs b/GlazeWM.Domain/Containers/JsonContainerConverter.csindex 9bf8460a..ce9c0762 100644--- a/GlazeWM.Domain/Containers/JsonContainerConverter.cs+++ b/GlazeWM.Domain/Containers/JsonContainerConverter.cs@@ -47,7 +47,8 @@ namespace GlazeWM.Domain.ContainersjsonObject.GetProperty("Y").GetInt32()),"Workspace" => new Workspace(- jsonObject.GetProperty("Name").GetString()+ jsonObject.GetProperty("Name").GetString(),+ jsonObject.GetProperty("Layout").Deserialize<Layout>()),"SplitContainer" => new SplitContainer{diff --git a/GlazeWM.Domain/Workspaces/CommandHandlers/ActivateWorkspaceHandler.cs b/GlazeWM.Domain/Workspaces/CommandHandlers/ActivateWorkspaceHandler.csindex f90dda1c..a34791ce 100644--- a/GlazeWM.Domain/Workspaces/CommandHandlers/ActivateWorkspaceHandler.cs+++ b/GlazeWM.Domain/Workspaces/CommandHandlers/ActivateWorkspaceHandler.cs@@ -2,6 +2,7 @@using GlazeWM.Domain.Workspaces.Commands;using GlazeWM.Domain.Containers.Commands;using GlazeWM.Domain.Workspaces.Events;+using GlazeWM.Domain.Common.Enums;namespace GlazeWM.Domain.Workspaces.CommandHandlers{@@ -19,7 +20,8 @@ namespace GlazeWM.Domain.Workspaces.CommandHandlersvar workspaceName = command.WorkspaceName;var targetMonitor = command.TargetMonitor;- var newWorkspace = new Workspace(workspaceName);+ Layout layout = targetMonitor.Height > targetMonitor.Width ? Layout.VERTICAL : Layout.HORIZONTAL;+ var newWorkspace = new Workspace(workspaceName, layout);// Attach the created workspace to the specified monitor._bus.Invoke(new AttachContainerCommand(newWorkspace, targetMonitor));diff --git a/GlazeWM.Domain/Workspaces/Workspace.cs b/GlazeWM.Domain/Workspaces/Workspace.csindex d8da2fbd..59b324ca 100644--- a/GlazeWM.Domain/Workspaces/Workspace.cs+++ b/GlazeWM.Domain/Workspaces/Workspace.cs@@ -1,4 +1,5 @@using System;+using GlazeWM.Domain.Common.Enums;using GlazeWM.Domain.Containers;using GlazeWM.Domain.Monitors;using GlazeWM.Domain.UserConfigs;@@ -62,8 +63,9 @@ namespace GlazeWM.Domain.Workspaces/// </summary>public bool IsDisplayed => (Parent as Monitor)?.DisplayedWorkspace == this;- public Workspace(string name)+ public Workspace(string name, Layout layout){+ this.Layout = layout;Id = $"WORKSPACE/{name}";Name = name;}