Skip to content

Isolate and improve optional window animations - #1886

Merged
rxhanson merged 1 commit into
rxhanson:mainfrom
kiteretsu903:fix/window-placement-animations
Oct 9, 2026
Merged

rxhanson merged 1 commit into
rxhanson:mainfrom
kiteretsu903:fix/window-placement-animations

Conversation

@kiteretsu903

@kiteretsu903 kiteretsu903 commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

This narrows #1886 to window animation. Animation remains off by default; when enabled, moves and resizes respond to the application's actual resize behavior, support a new destination while an animation is running, and check the final placement.

Behavior

  • Repeated shortcuts replace the current destination instead of queuing a sequence of old animations. Resize feedback adjusts how updates are issued to applications that respond slowly or constrain their size.
  • A new drag, cancellation, or window change invalidates pending work. An already-running Accessibility write must finish before a subsequent ordinary action takes over, so an old animation cannot overwrite the new action.
  • With animation disabled and no previous animation still retiring, placement follows the existing ordinary mover. Reduce Motion, VoiceOver, and Switch Control also disable animation.
  • The final frame is verified; intermediate animation frames are not treated as successful final placement. Applications retain control over their supported window sizes.

Implementation

Animation state, geometry caching, and bounded Accessibility operations live in WindowAnimationElement and the animation worker. AccessibilityElement does not own animation state. Related scheduling and execution code is grouped by responsibility, and crossesDisplays lives in WindowDisplayTransition.

Ordinary placement optimizations and snap-preview rendering changes have been extracted into #1899 and #1900 respectively. This PR contains neither Layout Helper preparation nor the experimental screenshot/parking animation.

Validation

The full branch XCTest suite passed (524 tests, including existing tests). Native window checks passed for ordinary and animated left/right placement, maximize/restore, rapid retargeting, and releasing a dragged window into a snap target. The same checks also passed in the combined build.

Physical cross-display transitions, older macOS versions, and the complete visual motion checklist remain to be checked. The current native checks establish window geometry and completion behavior, not a blanket claim of visually smooth animation on every application.

Comment thread Rectangle/AccessibilityElement.swift Outdated

class AccessibilityElement {
fileprivate let wrappedElement: AXUIElement
var animationReads: WindowAnimationReadCache?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move what we can out of AccessibilityElement to keep it simpler. Perhaps most of these additions, and animation logic can be in WindowAnimationElement?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's separate out the classes of this file into separate files, and group the animation-related classes into a folder.

@kiteretsu903

Copy link
Copy Markdown
Contributor Author

Thanks for the suggestions! Did the following fixes: (1) Moved animation-specific state, geometry caching, and write logic into WindowAnimationElement, leaving the general AX operations in AccessibilityElement. (2) Split the supporting animation types into separate files and grouped them under Rectangle/WindowAnimation/.
let me know if it makes sense!

@rxhanson

rxhanson commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Thanks again for your patience. Now that the dust has settled on v2.0, I finally had a bit more time to let this one sink in. I like to think of window animation as more of an additive feature, as opposed to one that permeates all of the app's functionality, since it is optional and currently not enabled by default. Is there any way we can make the animation logic a little less intrusive on existing infrastructure? I like keeping less surface area for risk where possible, especially in places that are used by all parts of the app already.

Also, the animation code is kinda tough to parse quickly as a human without AI assistance, and I think it's still valuable to make code that is a bit more readily human-understandable. Although I like that it's broken up into separate files now, we don't have to strictly adhere to one class per file, and perhaps there are more centralized places we can put some of the static functionality. One example is that crossesDisplays can be moved from WindowAnimator into WindowDisplayTransition, and I think there might be other places where we can consolidate or improve the flow.

@kiteretsu903

Copy link
Copy Markdown
Contributor Author

@rxhanson Thanks for the detailed suggestions as always! These practices are really helpful for me too. I’ve cleaned up the animation code, grouped related pieces together, and moved crossesDisplays. The non-animation optimizations are now in separate PRs (#1899 and #1900).
I also updated the other PRs with clearer specs and demos where useful. Some are drafts because they depend on earlier PRs. I’ll rebase them after we evaluate front PRs so the diffs stay focused.

Let me know if this organization is closer to what you had in mind!

@rxhanson
rxhanson merged commit b30326f into rxhanson:main Oct 9, 2026
1 check passed
@rxhanson

rxhanson commented Oct 9, 2026

Copy link
Copy Markdown
Owner

Thanks! This is a good improvement and it's nice to keep the complexity of the animation pretty well contained.

@kiteretsu903
kiteretsu903 deleted the fix/window-placement-animations branch October 13, 2026 03:46
rxhanson pushed a commit that referenced this pull request Oct 29, 2026
* Ignore keyboard shortcuts while Mission Control is active

Mission Control does not change the frontmost application, so Rectangle's
hotkeys kept firing and moved the last focused window behind the overview,
stretching its thumbnail (#1739).

ShortcutManager now takes a missionControlActiveProvider, defaulting to the
detector that #1886 added for window animations, and drops requests whose
source is .keyboardShortcut while it reports Mission Control, before anything
downstream observes them. Mouse-button shortcuts and duplicate-shortcut cycles
share that source and are covered; menu, URL, title-bar and drag-to-snap
requests are unchanged, and a dropped request still runs its completion.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* Make the Mission Control shortcut guard opt-out

Gate the #1739 guard behind a hidden default,
ignoreShortcutsInMissionControl, defaulting to true (the current
behavior). Users who prefer shortcuts to keep firing can opt out with:

  defaults write com.knollsoft.Rectangle ignoreShortcutsInMissionControl -bool false

BoolDefault gains an optional defaultValue (matching DoubleDefault and
the other Default types) so the toggle can default to true.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants