use gpui::{App, Global};
struct PauseWhenInactive(bool);
impl Global for PauseWhenInactive {}
pub trait AppExt {
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);
}
impl AppExt for App {
fn reduced_motion(&self) -> bool {
self.reduce_motion()
}
fn set_reduced_motion(&mut self, reduced: bool) {
self.set_reduce_motion(reduced);
}
fn pause_when_inactive(&self) -> bool {
self.try_global::<PauseWhenInactive>()
.is_none_or(|pause| pause.0)
}
fn set_pause_when_inactive(&mut self, pause: bool) {
self.set_global(PauseWhenInactive(pause));
}
}