Skip to content

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

feat(domain): created AddedMonitorId property on MonitorAddedEvent

Lars592a845bdbf7
diff --git a/LarsWM.Domain/Common/Services/KeybindingService.cs b/LarsWM.Domain/Common/Services/KeybindingService.cs
index bd0d5026..c63b9eec 100644
--- a/LarsWM.Domain/Common/Services/KeybindingService.cs
+++ b/LarsWM.Domain/Common/Services/KeybindingService.cs
@@ -71,7 +71,7 @@ namespace LarsWM.Domain.Common.Services
_modKeypresses.Subscribe(pressedKey =>
{
if (pressedKey == Keys.J)
- _bus.RaiseEvent(new MonitorAddedEvent());
+ Debug.WriteLine("Alt+J keybinding successfully triggered.");
}
);
}
diff --git a/LarsWM.Domain/Monitors/CommandHandlers/AddMonitorHandler.cs b/LarsWM.Domain/Monitors/CommandHandlers/AddMonitorHandler.cs
index 3d0728d7..b2eef498 100644
--- a/LarsWM.Domain/Monitors/CommandHandlers/AddMonitorHandler.cs
+++ b/LarsWM.Domain/Monitors/CommandHandlers/AddMonitorHandler.cs
@@ -15,11 +15,14 @@ namespace LarsWM.Domain.Monitors.CommandHandlers
_monitorService = monitorService;
}
- public void Handle(AddMonitorCommand command)
+ public CommandResponse Handle(AddMonitorCommand command)
{
- _monitorService.Monitors.Add(new Monitor(command.Screen));
+ var newMonitor = new Monitor(command.Screen);
+ _monitorService.Monitors.Add(newMonitor);
- _bus.RaiseEvent(new MonitorAddedEvent());
+ _bus.RaiseEvent(new MonitorAddedEvent(newMonitor.Id));
+
+ return new CommandResponse(true, newMonitor.Id);
}
}
}
diff --git a/LarsWM.Domain/Monitors/Events/MonitorAddedEvent.cs b/LarsWM.Domain/Monitors/Events/MonitorAddedEvent.cs
index ffc1e0c1..cfa8fe45 100644
--- a/LarsWM.Domain/Monitors/Events/MonitorAddedEvent.cs
+++ b/LarsWM.Domain/Monitors/Events/MonitorAddedEvent.cs
@@ -1,12 +1,15 @@
using LarsWM.Infrastructure.Bussing;
+using System;
namespace LarsWM.Domain.Monitors.Events
{
public class MonitorAddedEvent : Event
{
- public MonitorAddedEvent()
- {
+ public Guid AddedMonitorId { get; }
+ public MonitorAddedEvent(Guid addedMonitorId)
+ {
+ AddedMonitorId = addedMonitorId;
}
}
}