Skip to content

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
HolbyFPV committed Sep 17, 2023
1 parent 6bac18b commit 5709f00
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 2 deletions.
5 changes: 3 additions & 2 deletions GlazeWM.Domain/Common/Utils/LoggerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ public static void LogWindowEvent<T>(
Window window)
{
logger.LogDebug(
"{Message}: {ProcessName} {ClassName}",
"{Message}: P->{ProcessName} C->{ClassName} T->{Title}",
message,
window.ProcessName,
window.ClassName
window.ClassName,
window.Title
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
1 change: 1 addition & 0 deletions GlazeWM.Domain/DependencyInjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public static IServiceCollection AddDomainServices(this IServiceCollection servi
services.AddSingleton<ICommandHandler<MoveWindowToWorkspaceCommand>, MoveWindowToWorkspaceHandler>();
services.AddSingleton<ICommandHandler<UpdateWorkspacesFromConfigCommand>, UpdateWorkspacesFromConfigHandler>();
services.AddSingleton<ICommandHandler<MoveWorkspaceInDirectionCommand>, MoveWorkspaceInDirectionHandler>();
services.AddSingleton<ICommandHandler<RoundWindowBorderCommand>, RoundWindowBorderHandler>();

services.AddSingleton<IEventHandler<DisplaySettingsChangedEvent>, DisplaySettingsChangedHandler>();
services.AddSingleton<IEventHandler<WindowDestroyedEvent>, WindowDestroyedHandler>();
Expand Down
3 changes: 3 additions & 0 deletions GlazeWM.Domain/UserConfigs/CommandParsingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
18 changes: 18 additions & 0 deletions GlazeWM.Domain/Windows/CommandHandlers/RoundWindowBorderHandler.cs
Original file line number Diff line number Diff line change
@@ -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<RoundWindowBorderCommand>
{
public CommandResponse Handle(RoundWindowBorderCommand command)
{
uint cornerPreference = 0x2;
var target = command.TargetWindow;
WindowsApiService.DwmSetWindowAttribute(target.Handle, 0x21,ref cornerPreference, sizeof(uint));

return CommandResponse.Ok;
}
}
}
14 changes: 14 additions & 0 deletions GlazeWM.Domain/Windows/Commands/RoundWindowBorderCommand.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}
}

0 comments on commit 5709f00

Please sign in to comment.