Skip to content

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

feat(domain): workspaces are created based on those defined in user config

Lars7c5b50e8f51f
diff --git a/LarsWM.Domain/UserConfigs/CommandHandlers/ReadUserConfigHandler.cs b/LarsWM.Domain/UserConfigs/CommandHandlers/ReadUserConfigHandler.cs
index 7675e542..a7af3e6e 100644
--- a/LarsWM.Domain/UserConfigs/CommandHandlers/ReadUserConfigHandler.cs
+++ b/LarsWM.Domain/UserConfigs/CommandHandlers/ReadUserConfigHandler.cs
@@ -1,4 +1,5 @@
using LarsWM.Domain.UserConfigs.Commands;
+using LarsWM.Domain.Workspaces.Commands;
using LarsWM.Infrastructure.Bussing;
using System;
using System.IO;
@@ -10,10 +11,12 @@ namespace LarsWM.Domain.UserConfigs.CommandHandlers
class ReadUserConfigHandler : ICommandHandler<ReadUserConfigCommand>
{
private UserConfigService _userConfigService;
+ private IBus _bus;
- public ReadUserConfigHandler(UserConfigService userConfigService)
+ public ReadUserConfigHandler(UserConfigService userConfigService, IBus bus)
{
_userConfigService = userConfigService;
+ _bus = bus;
}
public CommandResponse Handle(ReadUserConfigCommand command)
@@ -29,6 +32,11 @@ namespace LarsWM.Domain.UserConfigs.CommandHandlers
var deserializedConfig = deserializer.Deserialize<UserConfigFileDto>(input);
+ foreach (var workspaceConfig in deserializedConfig.Workspaces)
+ {
+ _bus.Invoke(new CreateWorkspaceCommand(workspaceConfig.Name));
+ }
+
// TODO: Read user config from file / constructed through shell script.
var userConfig = new UserConfig();
_userConfigService.UserConfig = userConfig;
diff --git a/LarsWM.Domain/UserConfigs/Commands/ReadUserConfigCommand.cs b/LarsWM.Domain/UserConfigs/Commands/ReadUserConfigCommand.cs
index e315a305..6d80bc46 100644
--- a/LarsWM.Domain/UserConfigs/Commands/ReadUserConfigCommand.cs
+++ b/LarsWM.Domain/UserConfigs/Commands/ReadUserConfigCommand.cs
@@ -2,6 +2,7 @@
namespace LarsWM.Domain.UserConfigs.Commands
{
+ // TODO: Rename to EvaluateUserConfigCommand.
public class ReadUserConfigCommand : Command
{
}