Skip to content

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

refactor(infra,domain): move `ExitApplicationCommand` and its handler to infra project

Lars Bergera3d473be1136
diff --git a/GlazeWM.Domain/DependencyInjection.cs b/GlazeWM.Domain/DependencyInjection.cs
index e9b056f6..4eca82a2 100644
--- a/GlazeWM.Domain/DependencyInjection.cs
+++ b/GlazeWM.Domain/DependencyInjection.cs
@@ -35,7 +35,6 @@ namespace GlazeWM.Domain
services.AddSingleton<WindowService>();
services.AddSingleton<WorkspaceService>();
- services.AddSingleton<ICommandHandler<ExitApplicationCommand>, ExitApplicationHandler>();
services.AddSingleton<ICommandHandler<PopulateInitialStateCommand>, PopulateInitialStateHandler>();
services.AddSingleton<ICommandHandler<ExecProcessCommand>, ExecProcessHandler>();
services.AddSingleton<ICommandHandler<AttachAndResizeContainerCommand>, AttachAndResizeContainerHandler>();
diff --git a/GlazeWM.Domain/UserConfigs/CommandParsingService.cs b/GlazeWM.Domain/UserConfigs/CommandParsingService.cs
index 6d1752f0..dfd50e0e 100644
--- a/GlazeWM.Domain/UserConfigs/CommandParsingService.cs
+++ b/GlazeWM.Domain/UserConfigs/CommandParsingService.cs
@@ -12,6 +12,7 @@ using GlazeWM.Domain.Windows.Commands;
using GlazeWM.Domain.Workspaces.Commands;
using GlazeWM.Infrastructure.Bussing;
using GlazeWM.Infrastructure.Bussing.Commands;
+using GlazeWM.Infrastructure.Common.Commands;
using GlazeWM.Infrastructure.Exceptions;
using GlazeWM.Infrastructure.Utils;
using GlazeWM.Infrastructure.WindowsApi;
diff --git a/GlazeWM.Domain/Common/CommandHandlers/ExitApplicationHandler.cs b/GlazeWM.Infrastructure/Common/CommandHandlers/ExitApplicationHandler.cs
similarity index 81%
rename from GlazeWM.Domain/Common/CommandHandlers/ExitApplicationHandler.cs
rename to GlazeWM.Infrastructure/Common/CommandHandlers/ExitApplicationHandler.cs
index e84ac2bb..1926fcf3 100644
--- a/GlazeWM.Domain/Common/CommandHandlers/ExitApplicationHandler.cs
+++ b/GlazeWM.Infrastructure/Common/CommandHandlers/ExitApplicationHandler.cs
@@ -1,8 +1,8 @@
-using GlazeWM.Domain.Common.Commands;
using GlazeWM.Infrastructure.Bussing;
+using GlazeWM.Infrastructure.Common.Commands;
using GlazeWM.Infrastructure.WindowsApi.Events;
-namespace GlazeWM.Domain.Common.CommandHandlers
+namespace GlazeWM.Infrastructure.Common.CommandHandlers
{
internal class ExitApplicationHandler : ICommandHandler<ExitApplicationCommand>
{
@@ -16,6 +16,7 @@ namespace GlazeWM.Domain.Common.CommandHandlers
public CommandResponse Handle(ExitApplicationCommand command)
{
_bus.RaiseEvent(new ApplicationExitingEvent());
+
return CommandResponse.Ok;
}
}
diff --git a/GlazeWM.Domain/Common/Commands/ExitApplicationCommand.cs b/GlazeWM.Infrastructure/Common/Commands/ExitApplicationCommand.cs
similarity index 67%
rename from GlazeWM.Domain/Common/Commands/ExitApplicationCommand.cs
rename to GlazeWM.Infrastructure/Common/Commands/ExitApplicationCommand.cs
index f97adede..24503fd5 100644
--- a/GlazeWM.Domain/Common/Commands/ExitApplicationCommand.cs
+++ b/GlazeWM.Infrastructure/Common/Commands/ExitApplicationCommand.cs
@@ -1,6 +1,6 @@
using GlazeWM.Infrastructure.Bussing;
-namespace GlazeWM.Domain.Common.Commands
+namespace GlazeWM.Infrastructure.Common.Commands
{
public class ExitApplicationCommand : Command
{
diff --git a/GlazeWM.Infrastructure/DependencyInjection.cs b/GlazeWM.Infrastructure/DependencyInjection.cs
index 3af93651..cb0c6b6d 100644
--- a/GlazeWM.Infrastructure/DependencyInjection.cs
+++ b/GlazeWM.Infrastructure/DependencyInjection.cs
@@ -1,8 +1,10 @@
using GlazeWM.Infrastructure.Bussing;
using GlazeWM.Infrastructure.Bussing.CommandHandlers;
using GlazeWM.Infrastructure.Bussing.Commands;
-using GlazeWM.Infrastructure.WindowsApi;
+using GlazeWM.Infrastructure.Common.Commands;
+using GlazeWM.Infrastructure.Common.CommandHandlers;
using GlazeWM.Infrastructure.Serialization;
+using GlazeWM.Infrastructure.WindowsApi;
using Microsoft.Extensions.DependencyInjection;
namespace GlazeWM.Infrastructure
@@ -19,6 +21,7 @@ namespace GlazeWM.Infrastructure
services.AddSingleton<JsonService>();
services.AddSingleton<YamlService>();
+ services.AddSingleton<ICommandHandler<ExitApplicationCommand>, ExitApplicationHandler>();
services.AddSingleton<ICommandHandler<NoopCommand>, NoopHandler>();
// TODO: Change WindowsApiService to be compatible with DI.