Skip to main content

AppExt

Trait AppExt 

Source
pub trait AppExt {
    // Required methods
    fn reduced_motion(&self) -> bool;
    fn set_reduced_motion(&mut self, reduced: bool);
    fn pause_when_inactive(&self) -> bool;
    fn set_pause_when_inactive(&mut self, pause: bool);
}
Expand description

The motion settings an app carries.

use motion::AppExt as _;

cx.set_pause_when_inactive(false);   // a HUD that must keep moving unfocused

Required Methods§

Source

fn reduced_motion(&self) -> bool

gpui snaps every with_animation element when this is set — end state for oneshots, rest state for loops — and schedules no frames.

Source

fn set_reduced_motion(&mut self, reduced: bool)

Source

fn pause_when_inactive(&self) -> bool

Whether animation stops while the app is not frontmost. On by default.

Source

fn set_pause_when_inactive(&mut self, pause: bool)

An app in the background that keeps animating is spending a core on frames nobody is looking at. Nothing below this stops on its own: one spinner in a backgrounded window held 30fps and 22% of a core indefinitely (2026-08, debug build, M-series laptop), against 2% with this on. Turn it off for a window that must keep moving while something else has focus — a side panel, a floating HUD.

The claim is refused rather than cancelled, so nothing has to resume it: gpui refreshes a window when it becomes active, and the render that follows takes the claim again.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl AppExt for App

Implementors§