Skip to content

Commit

Permalink
refactor: use SystemSettings wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-berger committed Sep 11, 2023
1 parent dcd9af4 commit 3200d7d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 22 deletions.
15 changes: 2 additions & 13 deletions GlazeWM.App.Watcher/WatcherStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,7 @@ public static async Task<ExitCode> Run(int ipcServerPort)

// Get user's global setting for whether window animations are enabled. This
// needs to be restored on exit.
var animationInfo = new AnimationInfo();
SystemParametersInfo(
SystemParametersInfoFlags.GetAnimation,
animationInfo.CallbackSize,
ref animationInfo,
0
);
var animationsEnabled = SystemSettings.AreWindowAnimationsEnabled();

try
{
Expand Down Expand Up @@ -61,12 +55,7 @@ public static async Task<ExitCode> Run(int ipcServerPort)
RestoreHandles(managedHandles);

// Restore window animations setting to its initial value.
SystemParametersInfo(
SystemParametersInfoFlags.SetAnimation,
animationInfo.CallbackSize,
ref animationInfo,
0
);
SystemSettings.SetWindowAnimationsEnabled(animationsEnabled);

await client.DisconnectAsync();
return ExitCode.Success;
Expand Down
4 changes: 4 additions & 0 deletions GlazeWM.App.WindowManager/WmStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ public ExitCode Run()
_systemTrayIcon = new SystemTrayIcon(systemTrayIconConfig);
_systemTrayIcon.Show();

// Enable/disable window transition animations.
var animationsEnabled = _userConfigService.GeneralConfig.WindowAnimations;
SystemSettings.SetWindowAnimationsEnabled(animationsEnabled);

var nativeFocusReassigned = _bus.Events
.OfType<NativeFocusReassignedEvent>()
.Select((@event) => @event.FocusedContainer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,6 @@ public CommandResponse Handle(EvaluateUserConfigCommand command)
// Register keybindings.
_bus.Invoke(new RegisterKeybindingsCommand(deserializedConfig.Keybindings));

// Enable/disable window transition animations.
var animationInfo = new AnimationInfo();
SystemParametersInfo(
SystemParametersInfoFlags.SetAnimation,
animationInfo.CallbackSize,
ref animationInfo,
0
);

return CommandResponse.Ok;
}

Expand Down

0 comments on commit 3200d7d

Please sign in to comment.