diff --git a/GlazeWM.Domain/Common/Utils/LoggerExtensions.cs b/GlazeWM.Domain/Common/Utils/LoggerExtensions.cs index c1fa696f8..a3b67f408 100644 --- a/GlazeWM.Domain/Common/Utils/LoggerExtensions.cs +++ b/GlazeWM.Domain/Common/Utils/LoggerExtensions.cs @@ -14,10 +14,11 @@ public static void LogWindowEvent( Window window) { logger.LogDebug( - "{Message}: {ProcessName} {ClassName}", + "{Message}: P->{ProcessName} C->{ClassName} T->{Title}", message, window.ProcessName, - window.ClassName + window.ClassName, + window.Title ); } } diff --git a/GlazeWM.Domain/Containers/CommandHandlers/SetActiveWindowBorderHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/SetActiveWindowBorderHandler.cs index b458efeff..ce507540d 100644 --- a/GlazeWM.Domain/Containers/CommandHandlers/SetActiveWindowBorderHandler.cs +++ b/GlazeWM.Domain/Containers/CommandHandlers/SetActiveWindowBorderHandler.cs @@ -47,6 +47,30 @@ public CommandResponse Handle(SetActiveWindowBorderCommand command) ? rgbToUint(_userConfigService.FocusBorderConfig.Active.Color) : 0xFFFFFFFF; _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); + _ = DwmSetWindowAttribute(_lastFocused.Handle, BorderColorAttribute, ref activeColor, 4); return CommandResponse.Ok; } } diff --git a/GlazeWM.Domain/DependencyInjection.cs b/GlazeWM.Domain/DependencyInjection.cs index 2180e2ebe..3ec54ab37 100644 --- a/GlazeWM.Domain/DependencyInjection.cs +++ b/GlazeWM.Domain/DependencyInjection.cs @@ -85,6 +85,7 @@ public static IServiceCollection AddDomainServices(this IServiceCollection servi services.AddSingleton, MoveWindowToWorkspaceHandler>(); services.AddSingleton, UpdateWorkspacesFromConfigHandler>(); services.AddSingleton, MoveWorkspaceInDirectionHandler>(); + services.AddSingleton, RoundWindowBorderHandler>(); services.AddSingleton, DisplaySettingsChangedHandler>(); services.AddSingleton, WindowDestroyedHandler>(); diff --git a/GlazeWM.Domain/UserConfigs/CommandParsingService.cs b/GlazeWM.Domain/UserConfigs/CommandParsingService.cs index 17c510946..1a19767dd 100644 --- a/GlazeWM.Domain/UserConfigs/CommandParsingService.cs +++ b/GlazeWM.Domain/UserConfigs/CommandParsingService.cs @@ -218,6 +218,9 @@ private static Command ParseSetCommand(string[] commandParts, Container subjectC { return commandParts[1] switch { + "roundedwindow" => subjectContainer is Window + ? new RoundWindowBorderCommand(subjectContainer as Window) + : new NoopCommand(), "floating" => subjectContainer is Window ? new SetFloatingCommand(subjectContainer as Window) : new NoopCommand(), diff --git a/GlazeWM.Domain/Windows/CommandHandlers/RoundWindowBorderHandler.cs b/GlazeWM.Domain/Windows/CommandHandlers/RoundWindowBorderHandler.cs new file mode 100644 index 000000000..43665887f --- /dev/null +++ b/GlazeWM.Domain/Windows/CommandHandlers/RoundWindowBorderHandler.cs @@ -0,0 +1,18 @@ +using GlazeWM.Domain.Windows.Commands; +using GlazeWM.Infrastructure.Bussing; +using GlazeWM.Infrastructure.WindowsApi; + +namespace GlazeWM.Domain.Windows.CommandHandlers +{ + internal sealed class RoundWindowBorderHandler: ICommandHandler + { + public CommandResponse Handle(RoundWindowBorderCommand command) + { + uint cornerPreference = 0x2; + var target = command.TargetWindow; + WindowsApiService.DwmSetWindowAttribute(target.Handle, 0x21,ref cornerPreference, sizeof(uint)); + + return CommandResponse.Ok; + } + } +} diff --git a/GlazeWM.Domain/Windows/Commands/RoundWindowBorderCommand.cs b/GlazeWM.Domain/Windows/Commands/RoundWindowBorderCommand.cs new file mode 100644 index 000000000..e8b7476b1 --- /dev/null +++ b/GlazeWM.Domain/Windows/Commands/RoundWindowBorderCommand.cs @@ -0,0 +1,14 @@ +using GlazeWM.Infrastructure.Bussing; + +namespace GlazeWM.Domain.Windows.Commands +{ + public class RoundWindowBorderCommand: Command + { + public Window TargetWindow { get; } + + public RoundWindowBorderCommand(Window targetWindow) + { + TargetWindow = targetWindow; + } + } +}