Skip to content

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

feat(domain): add `ExitApplicationCommand` and its handler

Lars Berger58a82a82a26b
diff --git a/GlazeWM.Domain/Common/CommandHandlers/ExitApplicationHandler.cs b/GlazeWM.Domain/Common/CommandHandlers/ExitApplicationHandler.cs
new file mode 100644
index 00000000..66fb10c6
--- /dev/null
+++ b/GlazeWM.Domain/Common/CommandHandlers/ExitApplicationHandler.cs
@@ -0,0 +1,22 @@
+using GlazeWM.Domain.Common.Commands;
+using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.WindowsApi.Events;
+
+namespace GlazeWM.Domain.Common.CommandHandlers
+{
+ class ExitApplicationHandler : ICommandHandler<ExitApplicationCommand>
+ {
+ private Bus _bus;
+
+ public ExitApplicationHandler(Bus bus)
+ {
+ _bus = bus;
+ }
+
+ public CommandResponse Handle(ExitApplicationCommand command)
+ {
+ _bus.RaiseEvent(new ApplicationExitingEvent());
+ return CommandResponse.Ok;
+ }
+ }
+}
diff --git a/GlazeWM.Domain/Common/Commands/ExitApplicationCommand.cs b/GlazeWM.Domain/Common/Commands/ExitApplicationCommand.cs
new file mode 100644
index 00000000..f97adede
--- /dev/null
+++ b/GlazeWM.Domain/Common/Commands/ExitApplicationCommand.cs
@@ -0,0 +1,8 @@
+using GlazeWM.Infrastructure.Bussing;
+
+namespace GlazeWM.Domain.Common.Commands
+{
+ public class ExitApplicationCommand : Command
+ {
+ }
+}