Skip to content

gpui: Make inactive frame throttling configurable - #62628

Open
nolight132 wants to merge 1 commit into
zed-industries:mainfrom
nolight132:gpui-adjustable-throttle
Open

gpui: Make inactive frame throttling configurable#62628
nolight132 wants to merge 1 commit into
zed-industries:mainfrom
nolight132:gpui-adjustable-throttle

Conversation

@nolight132

Copy link
Copy Markdown
Contributor

Objective

I am building an app with GPUI, and the current animation throttling implementation does not quite meet its requirements. I needed the window to stay at a smooth framerate when unfocused to display lyrics, which was not possible at the time without modifying GPUI’s frame scheduling behavior. I understand that this is not a problem for Zed, but I believe making this behavior a field in WindowOptions could be beneficial for other programs going forward.

Solution

Added a field to WindowOptions struct which controls the minimum interval between animation frames while the window is inactive (documented). Kept the default value GPUI currently uses.

Testing

  • Ran gpui/src/examples/animation.rs with different presets - works as expected. Zed compiles. One thing worth noting: this setting does not guarantee the window refreshes at this exact interval, as frames are still paced by the compositor. For granular FPS control, a helper function is needed. I have decided to keep it simple and use the existing logic.
  • Tested on NixOS x86_64, Niri.

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content adheres to Zed's UI standards (UX/UI and icon guidelines)
  • Tests cover the new/changed behavior (the default didn't change, tests still pass)
  • Performance impact has been considered and is acceptable (no performance impact unless explicitly set)

Showcase

Before (unfocused):
image

After (unfocused with inactive_frame_interval set to 16ms):
image


Release Notes:

  • Added WindowOptions::inactive_frame_interval for configuring animation frame throttling on inactive GPUI windows.

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant