Skip to content

Space switching jitters — animation isn't smooth #37

Description

@amanfromsolan

Problem

Switching between spaces isn't smooth. There's a noticeable jitter during the transition — the swipe/switch doesn't hold a steady frame rate, and you can see it.

Spaces are a headline feature and the swipe between them is one of the most-touched interactions in the app. It needs to feel solid. Jitter here reads as "this app is janky" more than almost anything else would, because it's motion, and motion is where the eye is least forgiving.

Context

Commit 853889e ("Sidebar polish and space-switch flicker fixes") already took a pass at flicker in this exact transition. So this is either a recurrence, a residue that pass didn't cover, or a second distinct problem in the same place. Worth reading that change first rather than starting cold — whatever it fixed, it didn't fix this.

Where to look

Not yet diagnosed. Candidates, roughly in order of suspicion:

  • Terminal surfaces re-rendering mid-transition. Each space holds live libghostty surfaces. If switching causes them to be torn down, re-created, resized, or re-laid-out while the animation is running, the GPU work will land right on top of the frames that need to be smooth. This is the most likely culprit and the first thing to check.
  • Layout thrash in the sidebar — if the sidebar's contents are being rebuilt rather than transitioned, SwiftUI may be doing real layout work per frame.
  • The animation competing with state updates — anything that fires on space change (process-icon polling, breadcrumb updates, tab-namer work) landing during the transition window will steal main-thread time exactly when it can't be spared.

A good first step is simply watching it in Instruments during a switch and seeing whether the dropped frames are CPU-side (layout) or GPU-side (surface re-render). That answer eliminates most of the list above.

Notes

  • Reproduce on a space with several live terminal tabs — an empty space may well be perfectly smooth, which would itself be a strong hint that the terminal surfaces are the problem.
  • Worth confirming whether it jitters on both the swipe gesture and the keyboard/palette-driven switch. If only the gesture jitters, it's a tracking problem; if both do, it's the transition itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfixFixes broken or confusing behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions