diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-08-22 08:50:52 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-08-22 08:57:08 +0300 |
| commit | 210d5e90fe00ae9add5d841e1752b7f8c4a639a7 (patch) | |
| tree | ef1431ecb1744984105e7b30520581cb5a1c5219 /niri-config | |
| parent | 9d3beb49315ae4cde3d8edfb979fccda52af3fae (diff) | |
| download | niri-210d5e90fe00ae9add5d841e1752b7f8c4a639a7.tar.gz niri-210d5e90fe00ae9add5d841e1752b7f8c4a639a7.tar.bz2 niri-210d5e90fe00ae9add5d841e1752b7f8c4a639a7.zip | |
exit_confirm_dialog: Add open/close animation
Diffstat (limited to 'niri-config')
| -rw-r--r-- | niri-config/src/lib.rs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs index bd8a9854..691672f5 100644 --- a/niri-config/src/lib.rs +++ b/niri-config/src/lib.rs @@ -1109,6 +1109,8 @@ pub struct Animations { #[knuffel(child, default)] pub config_notification_open_close: ConfigNotificationOpenCloseAnim, #[knuffel(child, default)] + pub exit_confirmation_open_close: ExitConfirmationOpenCloseAnim, + #[knuffel(child, default)] pub screenshot_ui_open: ScreenshotUiOpenAnim, #[knuffel(child, default)] pub overview_open_close: OverviewOpenCloseAnim, @@ -1126,6 +1128,7 @@ impl Default for Animations { window_close: Default::default(), window_resize: Default::default(), config_notification_open_close: Default::default(), + exit_confirmation_open_close: Default::default(), screenshot_ui_open: Default::default(), overview_open_close: Default::default(), } @@ -1261,6 +1264,22 @@ impl Default for ConfigNotificationOpenCloseAnim { } #[derive(Debug, Clone, Copy, PartialEq)] +pub struct ExitConfirmationOpenCloseAnim(pub Animation); + +impl Default for ExitConfirmationOpenCloseAnim { + fn default() -> Self { + Self(Animation { + off: false, + kind: AnimationKind::Spring(SpringParams { + damping_ratio: 0.6, + stiffness: 500, + epsilon: 0.01, + }), + }) + } +} + +#[derive(Debug, Clone, Copy, PartialEq)] pub struct ScreenshotUiOpenAnim(pub Animation); impl Default for ScreenshotUiOpenAnim { @@ -3338,6 +3357,21 @@ where } } +impl<S> knuffel::Decode<S> for ExitConfirmationOpenCloseAnim +where + S: knuffel::traits::ErrorSpan, +{ + fn decode_node( + 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) + })?)) + } +} + impl<S> knuffel::Decode<S> for ScreenshotUiOpenAnim where S: knuffel::traits::ErrorSpan, @@ -5148,6 +5182,18 @@ mod tests { ), }, ), + exit_confirmation_open_close: ExitConfirmationOpenCloseAnim( + Animation { + off: false, + kind: Spring( + SpringParams { + damping_ratio: 0.6, + stiffness: 500, + epsilon: 0.01, + }, + ), + }, + ), screenshot_ui_open: ScreenshotUiOpenAnim( Animation { off: false, |
