Skip to content

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

feat: AddMonitorCommand adds Monitor to state and raises MonitorAddedEvent

Lars59d89e41d0f1
diff --git a/LarsWM.Core/Monitors/CommandHandlers/AddMonitorHandler.cs b/LarsWM.Core/Monitors/CommandHandlers/AddMonitorHandler.cs
index deeef18b..be1e2150 100644
--- a/LarsWM.Core/Monitors/CommandHandlers/AddMonitorHandler.cs
+++ b/LarsWM.Core/Monitors/CommandHandlers/AddMonitorHandler.cs
@@ -1,16 +1,26 @@
using LarsWM.Core.Common.Models;
+using LarsWM.Core.Common.Services;
using LarsWM.Core.Monitors.Commands;
-using System;
-using System.Collections.Generic;
-using System.Text;
+using LarsWM.Core.Monitors.Events;
namespace LarsWM.Core.Monitors.CommandHandlers
{
class AddMonitorHandler : ICommandHandler<AddMonitorCommand>
{
+ private AppState _appState;
+ private IBus _bus;
+
+ public AddMonitorHandler(IBus bus, AppState appState)
+ {
+ _bus = bus;
+ _appState = appState;
+ }
+
public void Handle(AddMonitorCommand command)
{
- throw new NotImplementedException();
+ _appState.Monitors.Add(new Monitor(command.Screen));
+
+ _bus.RaiseEvent(new MonitorAddedEvent());
}
}
}
diff --git a/LarsWM.Core/Monitors/Events/MonitorAddedEvent.cs b/LarsWM.Core/Monitors/Events/MonitorAddedEvent.cs
index e76d890d..1ee068bf 100644
--- a/LarsWM.Core/Monitors/Events/MonitorAddedEvent.cs
+++ b/LarsWM.Core/Monitors/Events/MonitorAddedEvent.cs
@@ -7,5 +7,9 @@ namespace LarsWM.Core.Monitors.Events
{
class MonitorAddedEvent : Event
{
+ public MonitorAddedEvent()
+ {
+
+ }
}
}