diff --git a/GlazeWM.App.WindowManager/WmStartup.cs b/GlazeWM.App.WindowManager/WmStartup.cs index b4ec77508..4d29513f4 100644 --- a/GlazeWM.App.WindowManager/WmStartup.cs +++ b/GlazeWM.App.WindowManager/WmStartup.cs @@ -19,6 +19,7 @@ public sealed class WmStartup { private readonly Bus _bus; private readonly KeybindingService _keybindingService; + private readonly WindowService _windowService; private readonly WindowEventService _windowEventService; private readonly UserConfigService _userConfigService; @@ -27,11 +28,13 @@ public sealed class WmStartup public WmStartup( Bus bus, KeybindingService keybindingService, + WindowService windowService, WindowEventService windowEventService, UserConfigService userConfigService) { _bus = bus; _keybindingService = keybindingService; + _windowService = windowService; _windowEventService = windowEventService; _userConfigService = userConfigService; } @@ -132,9 +135,16 @@ windowAnimations is WindowAnimations.True private void OnApplicationExit() { - _bus.Invoke(new ShowAllWindowsCommand()); + // Show all windows regardless of whether their workspace is displayed. + foreach (var window in _windowService.GetWindows()) + ShowWindowAsync(window.Handle, ShowWindowFlags.ShowNoActivate); + + // Clear border on the active window. _bus.Invoke(new SetActiveWindowBorderCommand(null)); + + // Destroy the system tray icon. _systemTrayIcon?.Remove(); + System.Windows.Forms.Application.Exit(); } } diff --git a/GlazeWM.Domain/DependencyInjection.cs b/GlazeWM.Domain/DependencyInjection.cs index 948ee68d3..6a1dfbe30 100644 --- a/GlazeWM.Domain/DependencyInjection.cs +++ b/GlazeWM.Domain/DependencyInjection.cs @@ -70,7 +70,6 @@ public static IServiceCollection AddDomainServices(this IServiceCollection servi services.AddSingleton, SetMinimizedHandler>(); services.AddSingleton, SetTilingHandler>(); services.AddSingleton, SetWindowSizeHandler>(); - services.AddSingleton, ShowAllWindowsHandler>(); services.AddSingleton, ToggleFloatingHandler>(); services.AddSingleton, ToggleMaximizedHandler>(); services.AddSingleton, UnmanageWindowHandler>(); diff --git a/GlazeWM.Domain/Windows/CommandHandlers/ShowAllWindowsHandler.cs b/GlazeWM.Domain/Windows/CommandHandlers/ShowAllWindowsHandler.cs deleted file mode 100644 index 8f324e117..000000000 --- a/GlazeWM.Domain/Windows/CommandHandlers/ShowAllWindowsHandler.cs +++ /dev/null @@ -1,25 +0,0 @@ -using GlazeWM.Domain.Windows.Commands; -using GlazeWM.Infrastructure.Bussing; -using static GlazeWM.Infrastructure.WindowsApi.WindowsApiService; - -namespace GlazeWM.Domain.Windows.CommandHandlers -{ - internal sealed class ShowAllWindowsHandler : ICommandHandler - { - private readonly WindowService _windowService; - - public ShowAllWindowsHandler(WindowService windowService) - { - _windowService = windowService; - } - - public CommandResponse Handle(ShowAllWindowsCommand command) - { - // Show all windows regardless of whether their workspace is displayed. - foreach (var window in _windowService.GetWindows()) - ShowWindowAsync(window.Handle, ShowWindowFlags.ShowNoActivate); - - return CommandResponse.Ok; - } - } -} diff --git a/GlazeWM.Domain/Windows/Commands/ShowAllWindowsCommand.cs b/GlazeWM.Domain/Windows/Commands/ShowAllWindowsCommand.cs deleted file mode 100644 index ab5558131..000000000 --- a/GlazeWM.Domain/Windows/Commands/ShowAllWindowsCommand.cs +++ /dev/null @@ -1,8 +0,0 @@ -using GlazeWM.Infrastructure.Bussing; - -namespace GlazeWM.Domain.Windows.Commands -{ - public class ShowAllWindowsCommand : Command - { - } -}