diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-05-12 09:52:21 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-05-12 09:52:36 +0400 |
| commit | 9004c8395438038d69f7b479a8a9035663cb4be0 (patch) | |
| tree | 349acfc1e9ac7df31bb52db66f7f9e8a59d19e79 /niri-config/src | |
| parent | 29c7552852874a08f9e70ed52ddfb6be8f55bc69 (diff) | |
| download | niri-9004c8395438038d69f7b479a8a9035663cb4be0.tar.gz niri-9004c8395438038d69f7b479a8a9035663cb4be0.tar.bz2 niri-9004c8395438038d69f7b479a8a9035663cb4be0.zip | |
Implement custom shader for window-close anim
Diffstat (limited to 'niri-config/src')
| -rw-r--r-- | niri-config/src/lib.rs | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs index 14119dc5..0388268d 100644 --- a/niri-config/src/lib.rs +++ b/niri-config/src/lib.rs @@ -552,18 +552,24 @@ impl Default for WindowOpenAnim { } } -#[derive(Debug, Clone, Copy, PartialEq)] -pub struct WindowCloseAnim(pub Animation); +#[derive(Debug, Clone, PartialEq)] +pub struct WindowCloseAnim { + pub anim: Animation, + pub custom_shader: Option<String>, +} impl Default for WindowCloseAnim { fn default() -> Self { - Self(Animation { - off: false, - kind: AnimationKind::Easing(EasingParams { - duration_ms: 150, - curve: AnimationCurve::EaseOutQuad, - }), - }) + Self { + anim: Animation { + off: false, + kind: AnimationKind::Easing(EasingParams { + duration_ms: 150, + curve: AnimationCurve::EaseOutQuad, + }), + }, + custom_shader: None, + } } } @@ -1420,10 +1426,21 @@ where node: &knuffel::ast::SpannedNode<S>, ctx: &mut knuffel::decode::Context<S>, ) -> Result<Self, DecodeError<S>> { - let default = Self::default().0; - Ok(Self(Animation::decode_node(node, ctx, default, |_, _| { - Ok(false) - })?)) + let default = Self::default().anim; + let mut custom_shader = None; + let anim = Animation::decode_node(node, ctx, default, |child, ctx| { + if &**child.node_name == "custom-shader" { + custom_shader = parse_arg_node("custom-shader", child, ctx)?; + Ok(true) + } else { + Ok(false) + } + })?; + + Ok(Self { + anim, + custom_shader, + }) } } |
