Skip to content

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

feat: naming changes to events (#369)

lars-berger6dc75940ef56
diff --git a/GlazeWM.App.Watcher/WatcherStartup.cs b/GlazeWM.App.Watcher/WatcherStartup.cs
index f750cdef..84dfc835 100644
--- a/GlazeWM.App.Watcher/WatcherStartup.cs
+++ b/GlazeWM.App.Watcher/WatcherStartup.cs
@@ -25,7 +25,7 @@ namespace GlazeWM.App.Watcher
// Subscribe to manage + unmanage window events.
_ = await client.SendAndWaitReplyAsync(
- "subscribe -e window_managed,window_unmanaged"
+ $"subscribe -e {DomainEvent.WindowManaged},{DomainEvent.WindowUnmanaged}"
);
// Continuously listen for manage + unmanage events.
@@ -73,11 +73,11 @@ namespace GlazeWM.App.Watcher
{
DomainEvent.WindowManaged => (
true,
- new IntPtr(response.GetProperty("window").GetProperty("handle").GetInt64())
+ new IntPtr(response.GetProperty("managedWindow").GetProperty("handle").GetInt64())
),
DomainEvent.WindowUnmanaged => (
false,
- new IntPtr(response.GetProperty("removedHandle").GetInt64())
+ new IntPtr(response.GetProperty("unmanagedHandle").GetInt64())
),
_ => throw new Exception("Received unrecognized event.")
};
diff --git a/GlazeWM.App/Program.cs b/GlazeWM.App/Program.cs
index 5a157fe6..eb953c09 100644
--- a/GlazeWM.App/Program.cs
+++ b/GlazeWM.App/Program.cs
@@ -26,8 +26,6 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Console;
using static GlazeWM.Infrastructure.WindowsApi.WindowsApiService;
-//// TODO: Handle circular reference for that one workspace event.
-
namespace GlazeWM.App
{
internal static class Program
diff --git a/GlazeWM.Domain/Common/Events/BindingModeChangedEvent.cs b/GlazeWM.Domain/Common/Events/BindingModeChangedEvent.cs
index ab6ff4f6..ca1ea857 100644
--- a/GlazeWM.Domain/Common/Events/BindingModeChangedEvent.cs
+++ b/GlazeWM.Domain/Common/Events/BindingModeChangedEvent.cs
@@ -2,6 +2,6 @@ using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Common.Events
{
- public record BindingModeChangedEvent(string BindingMode)
+ public record BindingModeChangedEvent(string NewBindingMode)
: Event(DomainEvent.BindingModeChanged);
}
diff --git a/GlazeWM.Domain/Monitors/CommandHandlers/RemoveMonitorHandler.cs b/GlazeWM.Domain/Monitors/CommandHandlers/RemoveMonitorHandler.cs
index dbce8e4f..fe50c18b 100644
--- a/GlazeWM.Domain/Monitors/CommandHandlers/RemoveMonitorHandler.cs
+++ b/GlazeWM.Domain/Monitors/CommandHandlers/RemoveMonitorHandler.cs
@@ -45,7 +45,7 @@ namespace GlazeWM.Domain.Monitors.CommandHandlers
}
_bus.Invoke(new DetachContainerCommand(monitorToRemove));
- _bus.Emit(new MonitorRemovedEvent(monitorToRemove.DeviceName));
+ _bus.Emit(new MonitorRemovedEvent(monitorToRemove.Id, monitorToRemove.DeviceName));
return CommandResponse.Ok;
}
diff --git a/GlazeWM.Domain/Monitors/Events/MonitorRemovedEvent.cs b/GlazeWM.Domain/Monitors/Events/MonitorRemovedEvent.cs
index d206c861..c1db71c4 100644
--- a/GlazeWM.Domain/Monitors/Events/MonitorRemovedEvent.cs
+++ b/GlazeWM.Domain/Monitors/Events/MonitorRemovedEvent.cs
@@ -1,8 +1,9 @@
+using System;
using GlazeWM.Domain.Common;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Monitors.Events
{
- public record MonitorRemovedEvent(string RemovedDeviceName)
+ public record MonitorRemovedEvent(Guid RemovedId, string RemovedDeviceName)
: Event(DomainEvent.MonitorRemoved);
}
diff --git a/GlazeWM.Domain/Windows/Events/WindowManagedEvent.cs b/GlazeWM.Domain/Windows/Events/WindowManagedEvent.cs
index c9ad5322..c8fc9739 100644
--- a/GlazeWM.Domain/Windows/Events/WindowManagedEvent.cs
+++ b/GlazeWM.Domain/Windows/Events/WindowManagedEvent.cs
@@ -3,5 +3,6 @@ using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.Events
{
- public record WindowManagedEvent(Window Window) : Event(DomainEvent.WindowManaged);
+ public record WindowManagedEvent(Window ManagedWindow)
+ : Event(DomainEvent.WindowManaged);
}
diff --git a/GlazeWM.Domain/Windows/Events/WindowUnmanagedEvent.cs b/GlazeWM.Domain/Windows/Events/WindowUnmanagedEvent.cs
index 365739ab..4ca8bc4a 100644
--- a/GlazeWM.Domain/Windows/Events/WindowUnmanagedEvent.cs
+++ b/GlazeWM.Domain/Windows/Events/WindowUnmanagedEvent.cs
@@ -4,6 +4,6 @@ using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Windows.Events
{
- public record WindowUnmanagedEvent(Guid RemovedId, IntPtr RemovedHandle)
+ public record WindowUnmanagedEvent(Guid UnmanagedId, IntPtr UnmanagedHandle)
: Event(DomainEvent.WindowUnmanaged);
}
diff --git a/GlazeWM.Domain/Workspaces/CommandHandlers/DeactivateWorkspaceHandler.cs b/GlazeWM.Domain/Workspaces/CommandHandlers/DeactivateWorkspaceHandler.cs
index 7733d870..d2c67459 100644
--- a/GlazeWM.Domain/Workspaces/CommandHandlers/DeactivateWorkspaceHandler.cs
+++ b/GlazeWM.Domain/Workspaces/CommandHandlers/DeactivateWorkspaceHandler.cs
@@ -19,7 +19,7 @@ namespace GlazeWM.Domain.Workspaces.CommandHandlers
var workspace = command.Workspace;
_bus.Invoke(new DetachContainerCommand(workspace));
- _bus.Emit(new WorkspaceDeactivatedEvent(workspace));
+ _bus.Emit(new WorkspaceDeactivatedEvent(workspace.Id, workspace.Name));
return CommandResponse.Ok;
}
diff --git a/GlazeWM.Domain/Workspaces/Events/WorkspaceDeactivatedEvent.cs b/GlazeWM.Domain/Workspaces/Events/WorkspaceDeactivatedEvent.cs
index 02cd0957..20306e26 100644
--- a/GlazeWM.Domain/Workspaces/Events/WorkspaceDeactivatedEvent.cs
+++ b/GlazeWM.Domain/Workspaces/Events/WorkspaceDeactivatedEvent.cs
@@ -1,8 +1,9 @@
+using System;
using GlazeWM.Domain.Common;
using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Domain.Workspaces.Events
{
- public record WorkspaceDeactivatedEvent(Workspace DeactivatedWorkspace)
+ public record WorkspaceDeactivatedEvent(Guid DeactivatedId, string DeactivatedName)
: Event(DomainEvent.WorkspaceDeactivated);
}