mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-18 22:58:34 +01:00
refactor(mac): use the behaviour enums of komorebi-config
core re-exports WindowContainerBehaviour, FloatingLayerBehaviour, Placement, CrossBoundaryBehaviour and WindowHidingPosition from komorebi-config; the local definitions and impls are removed, so no call site changes. Verified: macOS fake-CC cargo check --locked --target aarch64-apple-darwin --workspace --all-targets: finished, 0 errors, no new warnings (tier 2). Not verified: macOS unit tests.
This commit is contained in:
1 parent
5dc1fe0b4c
commit
d2a975aa0a
1 file changed
+5
-95
@@ -1,8 +1,5 @@
|
||||
use clap::ValueEnum;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use strum::Display;
|
||||
use strum::EnumString;
|
||||
|
||||
// Re-export types from komorebi-layouts
|
||||
pub use komorebi_layouts::Arrangement;
|
||||
@@ -32,6 +29,11 @@ pub use komorebi_layouts::validate_ratios;
|
||||
pub mod animation;
|
||||
pub mod asc;
|
||||
pub mod config_generation;
|
||||
pub use komorebi_config::behaviour::CrossBoundaryBehaviour;
|
||||
pub use komorebi_config::behaviour::FloatingLayerBehaviour;
|
||||
pub use komorebi_config::behaviour::Placement;
|
||||
pub use komorebi_config::behaviour::WindowContainerBehaviour;
|
||||
pub use komorebi_config::behaviour::WindowHidingPosition;
|
||||
pub use komorebi_protocol::pathext;
|
||||
pub use komorebi_protocol::types::ApplicationIdentifier;
|
||||
pub use komorebi_protocol::types::MonocleFocusBehaviour;
|
||||
@@ -67,98 +69,6 @@ pub struct WindowManagementBehaviour {
|
||||
pub float_rule_placement: Placement,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone, Copy, Debug, Default, Serialize, Deserialize, Display, EnumString, ValueEnum, PartialEq,
|
||||
)]
|
||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||
/// Window container behaviour when a new window is opened
|
||||
pub enum WindowContainerBehaviour {
|
||||
/// Create a new container for each new window
|
||||
#[default]
|
||||
Create,
|
||||
/// Append new windows to the focused window container
|
||||
Append,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone, Copy, Debug, Default, Serialize, Deserialize, Display, EnumString, ValueEnum, PartialEq,
|
||||
)]
|
||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||
/// Floating layer behaviour when a new window is opened
|
||||
pub enum FloatingLayerBehaviour {
|
||||
/// Tile new windows (unless they match a float rule or float override is active)
|
||||
#[default]
|
||||
Tile,
|
||||
/// Float new windows
|
||||
Float,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone, Copy, Debug, Default, Serialize, Deserialize, Display, EnumString, ValueEnum, PartialEq,
|
||||
)]
|
||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||
/// Window hiding position
|
||||
pub enum WindowHidingPosition {
|
||||
/// Hide windows in the bottom left corner of the screen
|
||||
#[default]
|
||||
BottomLeft,
|
||||
/// Hide windows in the bottom right corner of the screen
|
||||
BottomRight,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone, Copy, Debug, Default, Serialize, Deserialize, Display, EnumString, ValueEnum, PartialEq,
|
||||
)]
|
||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||
/// Placement behaviour for floating windows
|
||||
pub enum Placement {
|
||||
/// Does not change the size or position of the window
|
||||
#[default]
|
||||
None,
|
||||
/// Center the window without changing the size
|
||||
Center,
|
||||
/// Center the window and resize it according to the `AspectRatio`
|
||||
CenterAndResize,
|
||||
}
|
||||
|
||||
impl FloatingLayerBehaviour {
|
||||
pub fn should_float(&self) -> bool {
|
||||
match self {
|
||||
FloatingLayerBehaviour::Tile => false,
|
||||
FloatingLayerBehaviour::Float => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Placement {
|
||||
pub fn should_center(&self) -> bool {
|
||||
match self {
|
||||
Placement::None => false,
|
||||
Placement::Center | Placement::CenterAndResize => true,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn should_resize(&self) -> bool {
|
||||
match self {
|
||||
Placement::None | Placement::Center => false,
|
||||
Placement::CenterAndResize => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone, Copy, Debug, Default, Serialize, Deserialize, Display, EnumString, ValueEnum, PartialEq,
|
||||
)]
|
||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||
/// Behaviour when an action would cross a monitor boundary
|
||||
pub enum CrossBoundaryBehaviour {
|
||||
/// Attempt to perform actions across a workspace boundary
|
||||
Workspace,
|
||||
/// Attempt to perform actions across a monitor boundary
|
||||
#[default]
|
||||
Monitor,
|
||||
}
|
||||
|
||||
pub use komorebi_protocol::message::SocketMessage;
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in new issue
Block a user