Files
komorebi/komorebi-linux/src/animation/mod.rs
T
LGUG2Z cd3892de76 refactor(repo): move the platform libraries to their final directories (pure move)
komorebi/                          -> komorebi-windows/
komorebi-for-kde/komorebi/         -> komorebi-linux/
komorebi-for-mac/komorebi/         -> komorebi-macos/
komorebi-for-kde/komorebi-hotkeys/ -> komorebi-hotkeys/

The directories now carry the names of their packages (komorebi-windows, komorebi-linux,
komorebi-macos). Renames only: every file is a 100% rename (270 files); nothing is edited,
so the workspace does not build at this revision. The next revision fixes the paths.
2026-11-05 15:03:27 -08:00

47 lines
1.8 KiB
Rust

//! The animation settings (the `komorebic animation*` commands and the `animation` key of
//! `komorebi.json`).
//!
//! komorebi does not animate windows itself: KWin's Geometry Change effect animates a window going
//! to its place. [`movement_animation`] and [`movement_style`] are what the effect is told, in the
//! [`Look`](crate::backend::Look) the border manager asks the backend for. The stock effect has
//! one curve, an exponential ease out; komorebi's build of it takes every style. The `fps`
//! setting is stored and has nothing to map to: the compositor animates at the refresh rate of the
//! screen.
use crate::core::animation::AnimationStyle;
pub use komorebi_config::animation::PerAnimationPrefixConfig;
pub use prefix::AnimationPrefix;
pub mod prefix;
pub const DEFAULT_ANIMATION_ENABLED: bool = false;
pub const DEFAULT_ANIMATION_STYLE: AnimationStyle = AnimationStyle::Linear;
pub const DEFAULT_ANIMATION_DURATION: u64 = 250;
pub const DEFAULT_ANIMATION_FPS: u64 = 60;
/// Returns how long window movement is animated for, in milliseconds, or `None` when it is not
/// animated.
///
/// The `movement` settings win over the global ones, for whether it is animated and for how long.
pub fn movement_animation() -> Option<u64> {
crate::settings::settings()
.snapshot()
.shared
.animation
.motion_for(AnimationPrefix::Movement)
.map(|motion| motion.duration_ms)
}
/// Returns the easing of window movement: the `movement` style, else the global one.
pub fn movement_style() -> AnimationStyle {
let snapshot = crate::settings::settings().snapshot();
let animation = &snapshot.shared.animation;
animation
.style_per_animation
.get(&AnimationPrefix::Movement)
.copied()
.unwrap_or(animation.style)
}