mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-12-03 05:34:32 +01:00
refactor(komorebic-core): animation, animation-duration and animation-style join Messages
The three animation subcommands were listed as differing in arguments between the trees because the possible values of --animation-type came from three different AnimationPrefix enums. Since step 2 there is one, and the pages of the three trees are now the same text (checked by comparing the rendered pages without fences and widths), so the Windows definitions move into Messages and the copies in WindowsCommands, MacosCommands and the KDE komorebic go, with their arms. The pages are byte-identical to the oracle: this is a move, not a docs change. Verified: oracle: windows 187, macos 158, kde 166 pages byte-identical; native cargo test -p komorebic-core: 31 + 3 passed; KDE cargo test -p komorebic --locked: 80 passed; macOS fake-CC cargo check --locked: 0 errors; Windows clippy --workspace --locked --all-targets -D warnings clean.
This commit is contained in:
1 parent
d7282f76de
commit
a686b61916
7 files changed
+48
-139
No files matched your search
@@ -22,6 +22,7 @@ use komorebi_layouts::CycleDirection;
|
||||
use komorebi_layouts::DefaultLayout;
|
||||
use komorebi_layouts::OperationDirection;
|
||||
use komorebi_layouts::Sizing;
|
||||
use komorebi_protocol::animation::prefix::AnimationPrefix;
|
||||
use komorebi_protocol::pathext::replace_env_in_path;
|
||||
use komorebi_protocol::types::ApplicationIdentifier;
|
||||
use komorebi_protocol::types::HidingBehaviour;
|
||||
@@ -382,6 +383,35 @@ pub struct AnimationFps {
|
||||
/// Desired animation frames per second
|
||||
pub fps: u64,
|
||||
}
|
||||
|
||||
#[derive(Args, Clone, Debug)]
|
||||
pub struct Animation {
|
||||
#[clap(value_enum)]
|
||||
pub boolean_state: BooleanState,
|
||||
/// Animation type to apply the state to. If not specified, sets global state
|
||||
#[clap(value_enum, short, long)]
|
||||
pub animation_type: Option<AnimationPrefix>,
|
||||
}
|
||||
|
||||
#[derive(Args, Clone, Debug)]
|
||||
pub struct AnimationDuration {
|
||||
/// Desired animation durations in ms
|
||||
pub duration: u64,
|
||||
/// Animation type to apply the duration to. If not specified, sets global duration
|
||||
#[clap(value_enum, short, long)]
|
||||
pub animation_type: Option<AnimationPrefix>,
|
||||
}
|
||||
|
||||
#[derive(Args, Clone, Debug)]
|
||||
pub struct AnimationStyle {
|
||||
/// Desired ease function for animation
|
||||
#[clap(value_enum, short, long, default_value = "linear")]
|
||||
pub style: komorebi_protocol::animation::AnimationStyle,
|
||||
/// Animation type to apply the style to. If not specified, sets global style
|
||||
#[clap(value_enum, short, long)]
|
||||
pub animation_type: Option<AnimationPrefix>,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -354,6 +354,15 @@ pub enum Messages {
|
||||
/// Replace the configuration of a running instance of komorebi from a static configuration file
|
||||
#[clap(arg_required_else_help = true)]
|
||||
ReplaceConfiguration(ReplaceConfiguration),
|
||||
/// Enable or disable movement animations
|
||||
#[clap(arg_required_else_help = true)]
|
||||
Animation(Animation),
|
||||
/// Set the duration for movement animations in ms
|
||||
#[clap(arg_required_else_help = true)]
|
||||
AnimationDuration(AnimationDuration),
|
||||
/// Set the ease function for movement animations
|
||||
#[clap(arg_required_else_help = true)]
|
||||
AnimationStyle(AnimationStyle),
|
||||
}
|
||||
|
||||
impl Messages {
|
||||
@@ -644,6 +653,15 @@ impl From<Messages> for SocketMessage {
|
||||
}
|
||||
Messages::ToggleMouseFollowsFocus => SocketMessage::ToggleMouseFollowsFocus,
|
||||
Messages::ReplaceConfiguration(args) => SocketMessage::ReplaceConfiguration(args.path),
|
||||
Messages::Animation(args) => {
|
||||
SocketMessage::Animation(args.boolean_state.into(), args.animation_type)
|
||||
}
|
||||
Messages::AnimationDuration(args) => {
|
||||
SocketMessage::AnimationDuration(args.duration, args.animation_type)
|
||||
}
|
||||
Messages::AnimationStyle(args) => {
|
||||
SocketMessage::AnimationStyle(args.style, args.animation_type)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ use crate::args::*;
|
||||
use clap::Parser;
|
||||
use clap::Subcommand;
|
||||
use komorebi_layouts::*;
|
||||
use komorebi_protocol::animation::prefix::AnimationPrefix;
|
||||
use komorebi_protocol::pathext::replace_env_in_path;
|
||||
use komorebi_protocol::types::*;
|
||||
use std::num::NonZeroUsize;
|
||||
@@ -113,34 +112,6 @@ pub struct BorderColour {
|
||||
pub b: u32,
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
pub struct Animation {
|
||||
#[clap(value_enum)]
|
||||
pub boolean_state: BooleanState,
|
||||
/// Animation type to apply the state to. If not specified, sets global state
|
||||
#[clap(value_enum, short, long)]
|
||||
pub animation_type: Option<AnimationPrefix>,
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
pub struct AnimationDuration {
|
||||
/// Desired animation durations in ms
|
||||
pub duration: u64,
|
||||
/// Animation type to apply the duration to. If not specified, sets global duration
|
||||
#[clap(value_enum, short, long)]
|
||||
pub animation_type: Option<AnimationPrefix>,
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
pub struct AnimationStyle {
|
||||
/// Desired ease function for animation
|
||||
#[clap(value_enum, short, long, default_value = "linear")]
|
||||
pub style: komorebi_protocol::animation::AnimationStyle,
|
||||
/// Animation type to apply the style to. If not specified, sets global style
|
||||
#[clap(value_enum, short, long)]
|
||||
pub animation_type: Option<AnimationPrefix>,
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
pub struct Docgen {
|
||||
/// Output directory for generated documentation files
|
||||
@@ -373,15 +344,6 @@ pub enum MacosCommands {
|
||||
// TransparencyAlpha(TransparencyAlpha),
|
||||
// /// Toggle transparency for unfocused windows
|
||||
// ToggleTransparency,
|
||||
/// Enable or disable movement animations
|
||||
#[clap(arg_required_else_help = true)]
|
||||
Animation(Animation),
|
||||
/// Set the duration for movement animations in ms
|
||||
#[clap(arg_required_else_help = true)]
|
||||
AnimationDuration(AnimationDuration),
|
||||
/// Set the ease function for movement animations
|
||||
#[clap(arg_required_else_help = true)]
|
||||
AnimationStyle(AnimationStyle),
|
||||
// /// Enable or disable focus follows mouse for the operating system
|
||||
// #[clap(hide = true)]
|
||||
// #[clap(arg_required_else_help = true)]
|
||||
|
||||
@@ -4,7 +4,6 @@ use crate::args::*;
|
||||
use clap::Parser;
|
||||
use clap::Subcommand;
|
||||
use komorebi_layouts::*;
|
||||
use komorebi_protocol::animation::prefix::AnimationPrefix;
|
||||
use komorebi_protocol::pathext::replace_env_in_path;
|
||||
use komorebi_protocol::types::*;
|
||||
use std::num::NonZeroUsize;
|
||||
@@ -154,34 +153,6 @@ pub struct StackbarMode {
|
||||
pub mode: komorebi_protocol::types::StackbarMode,
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
pub struct Animation {
|
||||
#[clap(value_enum)]
|
||||
pub boolean_state: BooleanState,
|
||||
/// Animation type to apply the state to. If not specified, sets global state
|
||||
#[clap(value_enum, short, long)]
|
||||
pub animation_type: Option<AnimationPrefix>,
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
pub struct AnimationDuration {
|
||||
/// Desired animation durations in ms
|
||||
pub duration: u64,
|
||||
/// Animation type to apply the duration to. If not specified, sets global duration
|
||||
#[clap(value_enum, short, long)]
|
||||
pub animation_type: Option<AnimationPrefix>,
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
pub struct AnimationStyle {
|
||||
/// Desired ease function for animation
|
||||
#[clap(value_enum, short, long, default_value = "linear")]
|
||||
pub style: komorebi_protocol::animation::AnimationStyle,
|
||||
/// Animation type to apply the style to. If not specified, sets global style
|
||||
#[clap(value_enum, short, long)]
|
||||
pub animation_type: Option<AnimationPrefix>,
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
pub struct Docgen {
|
||||
/// Output directory for generated documentation files
|
||||
@@ -588,15 +559,6 @@ pub enum WindowsCommands {
|
||||
TransparencyAlpha(TransparencyAlpha),
|
||||
/// Toggle transparency for unfocused windows
|
||||
ToggleTransparency,
|
||||
/// Enable or disable movement animations
|
||||
#[clap(arg_required_else_help = true)]
|
||||
Animation(Animation),
|
||||
/// Set the duration for movement animations in ms
|
||||
#[clap(arg_required_else_help = true)]
|
||||
AnimationDuration(AnimationDuration),
|
||||
/// Set the ease function for movement animations
|
||||
#[clap(arg_required_else_help = true)]
|
||||
AnimationStyle(AnimationStyle),
|
||||
/// Enable or disable focus follows mouse for the operating system
|
||||
#[clap(hide = true)]
|
||||
#[clap(arg_required_else_help = true)]
|
||||
|
||||
@@ -455,15 +455,6 @@ enum KdeCommands {
|
||||
TransparencyAlpha(TransparencyAlpha),
|
||||
/// Toggle transparency for unfocused windows
|
||||
ToggleTransparency,
|
||||
/// Enable or disable movement animations
|
||||
#[clap(arg_required_else_help = true)]
|
||||
Animation(Animation),
|
||||
/// Set the duration for movement animations in ms
|
||||
#[clap(arg_required_else_help = true)]
|
||||
AnimationDuration(AnimationDuration),
|
||||
/// Set the ease function for movement animations
|
||||
#[clap(arg_required_else_help = true)]
|
||||
AnimationStyle(AnimationStyle),
|
||||
/// Enable or disable focus follows mouse (KWin's own focus policy)
|
||||
#[clap(arg_required_else_help = true)]
|
||||
FocusFollowsMouse(FocusFollowsMouse),
|
||||
@@ -886,24 +877,6 @@ fn main() -> eyre::Result<()> {
|
||||
KdeCommands::ToggleFocusFollowsMouse(args) => {
|
||||
send_message(&SocketMessage::ToggleFocusFollowsMouse(args.implementation))?;
|
||||
}
|
||||
KdeCommands::Animation(args) => {
|
||||
send_message(&SocketMessage::Animation(
|
||||
args.boolean_state.into(),
|
||||
args.animation_type,
|
||||
))?;
|
||||
}
|
||||
KdeCommands::AnimationDuration(args) => {
|
||||
send_message(&SocketMessage::AnimationDuration(
|
||||
args.duration,
|
||||
args.animation_type,
|
||||
))?;
|
||||
}
|
||||
KdeCommands::AnimationStyle(args) => {
|
||||
send_message(&SocketMessage::AnimationStyle(
|
||||
args.style,
|
||||
args.animation_type,
|
||||
))?;
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -851,24 +851,6 @@ exit 1
|
||||
args.b,
|
||||
))?;
|
||||
}
|
||||
MacosCommands::Animation(args) => {
|
||||
send_message(&SocketMessage::Animation(
|
||||
args.boolean_state.into(),
|
||||
args.animation_type,
|
||||
))?;
|
||||
}
|
||||
MacosCommands::AnimationDuration(args) => {
|
||||
send_message(&SocketMessage::AnimationDuration(
|
||||
args.duration,
|
||||
args.animation_type,
|
||||
))?;
|
||||
}
|
||||
MacosCommands::AnimationStyle(args) => {
|
||||
send_message(&SocketMessage::AnimationStyle(
|
||||
args.style,
|
||||
args.animation_type,
|
||||
))?;
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -1331,24 +1331,6 @@ if (Get-Command Get-CimInstance -ErrorAction SilentlyContinue) {
|
||||
WindowsCommands::ToggleTransparency => {
|
||||
send_message(&SocketMessage::ToggleTransparency)?;
|
||||
}
|
||||
WindowsCommands::Animation(args) => {
|
||||
send_message(&SocketMessage::Animation(
|
||||
args.boolean_state.into(),
|
||||
args.animation_type,
|
||||
))?;
|
||||
}
|
||||
WindowsCommands::AnimationDuration(args) => {
|
||||
send_message(&SocketMessage::AnimationDuration(
|
||||
args.duration,
|
||||
args.animation_type,
|
||||
))?;
|
||||
}
|
||||
WindowsCommands::AnimationStyle(args) => {
|
||||
send_message(&SocketMessage::AnimationStyle(
|
||||
args.style,
|
||||
args.animation_type,
|
||||
))?;
|
||||
}
|
||||
|
||||
WindowsCommands::ToggleWindowContainerBehaviour => {
|
||||
send_message(&SocketMessage::ToggleWindowContainerBehaviour)?;
|
||||
|
||||
Reference in new issue
Block a user