GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
feat(domain): add `ShowAllWindowsCommand` and its handler
Lars Berger7cd7f2da6aeb
diff --git a/GlazeWM.Domain/Windows/CommandHandlers/ShowAllWindowsHandler.cs b/GlazeWM.Domain/Windows/CommandHandlers/ShowAllWindowsHandler.csnew file mode 100644index 00000000..e25e6e08--- /dev/null+++ b/GlazeWM.Domain/Windows/CommandHandlers/ShowAllWindowsHandler.cs@@ -0,0 +1,39 @@+using System;+using GlazeWM.Domain.Windows.Commands;+using GlazeWM.Infrastructure.Bussing;+using static GlazeWM.Infrastructure.WindowsApi.WindowsApiService;++namespace GlazeWM.Domain.Windows.CommandHandlers+{+ class ShowAllWindowsHandler : ICommandHandler<ShowAllWindowsCommand>+ {+ private WindowService _windowService;++ public ShowAllWindowsHandler(WindowService windowService)+ {+ _windowService = windowService;+ }++ public CommandResponse Handle(ShowAllWindowsCommand command)+ {+ // Reset all managed windows to their floating positions.+ foreach (var window in _windowService.GetWindows())+ {+ var flags = SWP.SWP_FRAMECHANGED | SWP.SWP_NOACTIVATE | SWP.SWP_NOCOPYBITS |+ SWP.SWP_NOZORDER | SWP.SWP_NOOWNERZORDER | SWP.SWP_NOSENDCHANGING | SWP.SWP_SHOWWINDOW;++ SetWindowPos(+ window.Hwnd,+ IntPtr.Zero,+ window.FloatingPlacement.Left,+ window.FloatingPlacement.Top,+ window.FloatingPlacement.Right - window.FloatingPlacement.Left,+ window.FloatingPlacement.Bottom - window.FloatingPlacement.Top,+ flags+ );+ }++ return CommandResponse.Ok;+ }+ }+}diff --git a/GlazeWM.Domain/Windows/Commands/ShowAllWindowsCommand.cs b/GlazeWM.Domain/Windows/Commands/ShowAllWindowsCommand.csnew file mode 100644index 00000000..4a0037a1--- /dev/null+++ b/GlazeWM.Domain/Windows/Commands/ShowAllWindowsCommand.cs@@ -0,0 +1,8 @@+using GlazeWM.Infrastructure.Bussing;++namespace GlazeWM.Domain.Windows.Commands+{+ public class ShowAllWindowsCommand : Command+ {+ }+}