From f42457e2e884df833823037df5bb1123b2c03079 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Tue, 23 Dec 2025 18:55:50 -0800 Subject: [PATCH] feat(animation): add window movement animations This commit adds window movement animations to komorebi for macOS, maintaining configuration API compatibility with komorebi for Windows. The animation system is adapted from the Windows implementation but uses macOS-specific APIs for screen update batching and accessibility control, and borrows heavily from the implementation details of animations in rift. In order to have decent performance, there are some calls to private APIS. For this reason, the animation feature will be marked as "UNSAFE". UNSAFE features should be expected to break between major operating system updates, and depending on which way I want to go, may only support one major macOS version at a time (i.e. they will not have a backwards compatibility guarantee with previous versions of macOS). This currently look awful when used with the Scrolling layout, but looks relatively good with other layouts. As with Windows, the animations when two windows of very different sizes change position aren't great. Some high level notes on the implementation: * Uses the private SkyLight framework for screen update batching via SLSDisableUpdate/SLSReenableUpdate - these APIs prevent visual flicker by compositing all window position changes at once rather than updating each window individually during layout operations * AnimationEngine runs animations in background threads with frame-based timing, supporting cancellation when new animations are triggered for the same window * MovementRenderDispatcher implements the RenderDispatcher trait to interpolate window positions using configurable easing functions * All 30+ easing styles from the Windows implementation are supported, including standard CSS-style functions and CubicBezier for custom curves * Enhanced User Interface (AXEnhancedUserInterface) is temporarily disabled during window positioning operations for better performance * The Transparency animation prefix is not supported on macOS as there is no equivalent to the Win32 transparency feature This feature is off-by-default and can be enabled in the static config or via komorebic commands (animation, animation-duration, animation-fps, animation-style). --- docs/cli/animation-duration.md | 21 + docs/cli/animation-fps.md | 16 + docs/cli/animation-style.md | 24 + docs/cli/animation.md | 21 + komorebi-client/src/lib.rs | 2 + komorebi/build.rs | 7 + komorebi/src/accessibility/mod.rs | 48 ++ komorebi/src/accessibility/private.rs | 54 +++ komorebi/src/animation/animation_manager.rs | 115 +++++ komorebi/src/animation/engine.rs | 121 +++++ komorebi/src/animation/lerp.rs | 77 +++ komorebi/src/animation/mod.rs | 59 +++ komorebi/src/animation/prefix.rs | 21 + komorebi/src/animation/render_dispatcher.rs | 8 + komorebi/src/animation/style.rs | 507 ++++++++++++++++++++ komorebi/src/core/animation.rs | 120 +++++ komorebi/src/core/mod.rs | 11 +- komorebi/src/lib.rs | 1 + komorebi/src/process_command.rs | 42 ++ komorebi/src/skylight.rs | 13 +- komorebi/src/static_config.rs | 126 ++--- komorebi/src/window.rs | 173 +++++++ komorebi/src/workspace.rs | 120 +++-- komorebic/src/main.rs | 79 ++- mkdocs.yml | 6 +- 25 files changed, 1664 insertions(+), 128 deletions(-) create mode 100644 docs/cli/animation-duration.md create mode 100644 docs/cli/animation-fps.md create mode 100644 docs/cli/animation-style.md create mode 100644 docs/cli/animation.md create mode 100644 komorebi/build.rs create mode 100644 komorebi/src/animation/animation_manager.rs create mode 100644 komorebi/src/animation/engine.rs create mode 100644 komorebi/src/animation/lerp.rs create mode 100644 komorebi/src/animation/mod.rs create mode 100644 komorebi/src/animation/prefix.rs create mode 100644 komorebi/src/animation/render_dispatcher.rs create mode 100644 komorebi/src/animation/style.rs create mode 100644 komorebi/src/core/animation.rs diff --git a/docs/cli/animation-duration.md b/docs/cli/animation-duration.md new file mode 100644 index 00000000..dbbcb2b1 --- /dev/null +++ b/docs/cli/animation-duration.md @@ -0,0 +1,21 @@ +# animation-duration + +``` +Set the duration for movement animations in ms + +Usage: komorebic animation-duration [OPTIONS] + +Arguments: + + Desired animation durations in ms + +Options: + -a, --animation-type + Animation type to apply the duration to. If not specified, sets global duration + + [possible values: movement] + + -h, --help + Print help + +``` \ No newline at end of file diff --git a/docs/cli/animation-fps.md b/docs/cli/animation-fps.md new file mode 100644 index 00000000..c2a34d07 --- /dev/null +++ b/docs/cli/animation-fps.md @@ -0,0 +1,16 @@ +# animation-fps + +``` +Set the frames per second for movement animations + +Usage: komorebic animation-fps + +Arguments: + + Desired animation frames per second + +Options: + -h, --help + Print help + +``` \ No newline at end of file diff --git a/docs/cli/animation-style.md b/docs/cli/animation-style.md new file mode 100644 index 00000000..a8b47396 --- /dev/null +++ b/docs/cli/animation-style.md @@ -0,0 +1,24 @@ +# animation-style + +``` +Set the ease function for movement animations + +Usage: komorebic animation-style [OPTIONS] + +Options: + -s, --style