Skip to content

fix(app): play the dashboard's looping animations in Core Animation - #108

Merged
yogeshprasad098 merged 2 commits into
mainfrom
fix/window-server-animations
Nov 27, 2026
Merged

yogeshprasad098 merged 2 commits into
mainfrom
fix/window-server-animations

Conversation

@yogeshprasad098

@yogeshprasad098 yogeshprasad098 commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Refs #90

With 0.3.2, the open dashboard still used 9 to 17% CPU while it was in front: 17% on Overview, about 9% on every other page. The pinging status dots (the sidebar's "Helper running" dot is on every page) and the moving dashes on the Power card were TimelineViews at 30 frames a second. A sample of the installed 0.3.2 showed each frame spent in SwiftUI updating the window's layers and in CA::Transaction::commit, sending the whole layer tree to the window server.

Both are now Core Animation layer animations (App/Design/LayerAnimations.swift), which the window server plays without the app. They keep 30 frames a second, stay in step across copies, and stop while the window is hidden or another app is in front, as before. Reduce Motion still stills them.

Review focus

The first try left the animations running at the display's rate and while the window was inactive, and the window server went from 18% to 38% CPU. Capping them at 30 frames a second with preferredFrameRateRange and stopping them when the window is inactive brought it back to where it was. The ring is hidden, not frozen mid-ping, while it is stopped.

Testing

Tested on an M3 MacBook Air, macOS 27.2.1, Debug build with --demo, Overview in front then behind Finder, CPU from ps over 20 s:

App, in front App, behind Window server, in front Window server, behind
0.3.2, fixed readings 13.4% 1% 25.3% 13.2%
This PR, fixed readings 2.4% 1% 23.9% 12.6%
0.3.2, --live-readings 16% 5% 24.4% 11.9%
This PR, --live-readings 5.6% 5.5% 20.9% 12.3%

The window server idles at about 15% on this Mac with nothing of ours open. Screenshots taken 0.3 s apart show the dashes moving and both status dots pinging in step; the design renders show the dashes in light and dark. ./scripts/check.sh passes.

Not tested: the release build with real readings. I'll measure it on the installed app after the release.

  • CHANGELOG.md has an entry under Unreleased saying what a user now sees, or nothing user-visible changed.
  • Docs are updated, or the change needs none.
  • A breaking change has ! in the title and the migration above.

yogeshprasad098 and others added 2 commits November 26, 2026 16:26
The open dashboard used 9 to 17% CPU while it was in front. The pinging
status dots and the moving dashes on the Power card were TimelineViews
at 30 frames a second, and each frame had SwiftUI update the window's
layers and send the whole layer tree to the window server.

Play both as Core Animation layer animations instead, which the window
server runs without the app. They keep 30 frames a second and stop
while the window is hidden or another app is in front, so the window
server does no more work than before. In the demo build with the window
in front, the app goes from 13% to 2% CPU.

Refs #90

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added area: dashboard The Chargectl window and the setup window area: ci CI, the check scripts and the build setup labels Nov 27, 2026
@yogeshprasad098
yogeshprasad098 merged commit 3d37472 into main Nov 27, 2026
9 checks passed
@yogeshprasad098
yogeshprasad098 deleted the fix/window-server-animations branch November 27, 2026 00:31
yogeshprasad098 added a commit that referenced this pull request Nov 27, 2026
…108)

The open dashboard used 9 to 17% CPU while it was in front. The pinging
status dots and the moving dashes on the Power card were TimelineViews
at 30 frames a second, and each frame had SwiftUI update the window's
layers and send the whole layer tree to the window server.

Play both as Core Animation layer animations instead, which the window
server runs without the app. They keep 30 frames a second and stop
while the window is hidden or another app is in front, so the window
server does no more work than before. In the demo build with the window
in front, the app goes from 13% to 2% CPU.

Refs #90
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI, the check scripts and the build setup area: dashboard The Chargectl window and the setup window

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant