feat(config): adds per animation configuration options

Originally static config only allows global config for animations.
Since this refactor introduces abilty to add more type of animations,
this change allows to configure `enabled`, `duration` and `style` state
per animation type.
Now each of them take either raw value or 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:
thearturca
2024-11-10 15:24:28 +03:00
parent e502cb3ffb
commit 369107f5e0
10 changed files with 237 additions and 62 deletions
+21 -3
View File
@@ -723,12 +723,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)]
@@ -742,6 +748,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)]
@@ -2539,16 +2548,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) => {