mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-04-23 00:58:37 +02:00
refactor(animation): new animations engine
This commit is comprised of the following interactively rebased commits from PR #1002 by @thearturca.1a184a4442refactor(animation): move animations to its own mod First step for more rusty version animations. The goal is to make animations more generic so its easier to add new animations to komorebi!d3ac6b72c2refactor(animation): reduce mutex calls on `ANIMATION_STYLE`8a42b738ferefactor(animation): introduce `Lerp` traite449861c10refactor(animation): generalized ANIMATION_MANAGER Instead of a isize key for the ANIMATION_MANAGER HashMap, now we use a String key. For window move animation, the key would be `window_move:{hwnd}`. This allows us to use single manager for more types of animations.67b2a7a284feat(animation): introduce `AnimationPrefix` enum8290f143a6feat(animation): introduce `RenderDispatcher` trait2400d757fefeat(animation): implement window transparency animation This commit also fixes graceful shutdown of animations by disabling them before exit and wait for all remaining animations for 20 seconds.44189d8382refactor(animation): move generation of `animation key` to `RenderDispatcher`e502cb3ffbrefactor(animation): rename `animation` mod to `engine` Linter was upset about this: > error: module has the same name as its containing module369107f5e0feat(config): adds per animation configuration options Originally static config only allowed global config for animations. Since this refactor introduces the abilty to add more type of animations, this change allows us to configure `enabled`, `duration` and `style` state per animation type. Now each of them take either the raw value or a JSON object where keys are the animation types and values are desired config value. Also adds support for per animation configuration for komorebic commands.
This commit is contained in:
@@ -724,12 +724,18 @@ struct BorderImplementation {
|
||||
struct Animation {
|
||||
#[clap(value_enum)]
|
||||
boolean_state: BooleanState,
|
||||
/// Animation type to apply the state to. If not specified, sets global state
|
||||
#[clap(value_enum, short, long)]
|
||||
animation_type: Option<komorebi_client::AnimationPrefix>,
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
struct AnimationDuration {
|
||||
/// Desired animation durations in ms
|
||||
duration: u64,
|
||||
/// Animation type to apply the duration to. If not specified, sets global duration
|
||||
#[clap(value_enum, short, long)]
|
||||
animation_type: Option<komorebi_client::AnimationPrefix>,
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
@@ -743,6 +749,9 @@ struct AnimationStyle {
|
||||
/// Desired ease function for animation
|
||||
#[clap(value_enum, short, long, default_value = "linear")]
|
||||
style: komorebi_client::AnimationStyle,
|
||||
/// Animation type to apply the style to. If not specified, sets global style
|
||||
#[clap(value_enum, short, long)]
|
||||
animation_type: Option<komorebi_client::AnimationPrefix>,
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
@@ -2546,16 +2555,25 @@ Stop-Process -Name:komorebi -ErrorAction SilentlyContinue
|
||||
send_message(&SocketMessage::ToggleTransparency)?;
|
||||
}
|
||||
SubCommand::Animation(arg) => {
|
||||
send_message(&SocketMessage::Animation(arg.boolean_state.into()))?;
|
||||
send_message(&SocketMessage::Animation(
|
||||
arg.boolean_state.into(),
|
||||
arg.animation_type,
|
||||
))?;
|
||||
}
|
||||
SubCommand::AnimationDuration(arg) => {
|
||||
send_message(&SocketMessage::AnimationDuration(arg.duration))?;
|
||||
send_message(&SocketMessage::AnimationDuration(
|
||||
arg.duration,
|
||||
arg.animation_type,
|
||||
))?;
|
||||
}
|
||||
SubCommand::AnimationFps(arg) => {
|
||||
send_message(&SocketMessage::AnimationFps(arg.fps))?;
|
||||
}
|
||||
SubCommand::AnimationStyle(arg) => {
|
||||
send_message(&SocketMessage::AnimationStyle(arg.style))?;
|
||||
send_message(&SocketMessage::AnimationStyle(
|
||||
arg.style,
|
||||
arg.animation_type,
|
||||
))?;
|
||||
}
|
||||
|
||||
SubCommand::ResizeDelta(arg) => {
|
||||
|
||||
Reference in New Issue
Block a user