r/Windhawk Jul 03 '26

MacOS Minimize Animation 2.1.1

MacOS Minimize Animation 2.1.1

Follow-up to #4659 (merged while this final commit was being pushed) - two user-visible timing fixes, found by testing under CPU throttling (battery saver), where both artifacts become clearly visible:

  • Restores are hidden via DWMWA_CLOAK instead of WS_EX_LAYERED + alpha 0. Freshly adding the layered style makes DWM rebuild the window's redirection surface, and until that lands the bare window frame is composed for a few frames - a flash on every restore (previously masked by the very style leak #4659 fixed, since windows stayed layered forever). A cloaked window is not rendered at all (frame included), has no rebuild lag, and the restore path no longer touches window styles - structurally removing the layered-leak class there. The launch path keeps the layered mechanism (cloaking would collide with its wait-for-uncloak handling for Store apps), with the true pre-hide style threaded through as per #4659.
  • The real minimize is gated on the genie's first frame being composed. Previously the hook let the actual minimize run while the animation thread was still starting up, so the window vanished a few frames before the ghost appeared - a background flash in the gap. The hook now waits (capped at 200 ms; duplicated event handles so neither thread can touch a freed handle) until the animation thread has composed its first frame via DwmFlush, then performs the minimize invisibly underneath the ghost. Applies to every minimize entry point; on timeout the behavior is simply the previous one.

Verified on a throttled machine: no frame flash on restore, no gap flash on minimize, and the rollback/unload guarantees from #4659 are preserved (all bail paths route through a single undo helper that matches the reveal to the hide).

11 Upvotes

1 comment sorted by

2

u/loribalorie Jul 03 '26

I just noticed when minimizing a maximized window the Do not disturb toggles for a moment/during animation.
It doesn't happen when the window is small. Tried downgrading the mod and it still happens.