GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
feat(domain): throw user error if there aren't enough workspaces for # of monitors
Lars Berger77a96ec7e628
diff --git a/LarsWM.Domain/Monitors/EventHandlers/MonitorAddedHandler.cs b/LarsWM.Domain/Monitors/EventHandlers/MonitorAddedHandler.csindex d2ce1e9c..e6dc36de 100644--- a/LarsWM.Domain/Monitors/EventHandlers/MonitorAddedHandler.cs+++ b/LarsWM.Domain/Monitors/EventHandlers/MonitorAddedHandler.cs@@ -3,8 +3,6 @@ using LarsWM.Domain.Monitors.Events;using LarsWM.Domain.Workspaces.Commands;using System.Linq;using LarsWM.Domain.Workspaces;-using LarsWM.Domain.Monitors.CommandHandlers;-using LarsWM.Domain.Monitors.Commands;namespace LarsWM.Domain.Monitors.EventHandler{@@ -19,15 +17,14 @@ namespace LarsWM.Domain.Monitors.EventHandler_workspaceService = workspaceService;}+ // TODO: Move this to `AddMonitorHandler`.public void Handle(MonitorAddedEvent @event){// Get first workspace that is not active.- var inactiveWorkspace = _workspaceService.InactiveWorkspaces[0];+ var inactiveWorkspace = _workspaceService.InactiveWorkspaces.ElementAtOrDefault(0);if (inactiveWorkspace == null)- {- // TODO: Show some kind of error notification.- }+ throw new FatalUserException("At least 1 workspace is required per monitor.");// Assign the workspace to the newly added monitor._bus.Invoke(new AttachWorkspaceToMonitorCommand(inactiveWorkspace, @event.AddedMonitor));