refactor(layouts): migrate to komorebi-layouts crate

This commit migrates to the new komorebi-layouts crate exposed in the
LGUG2Z/komorebi repository, significantly reducing duplication and
change maintenance between the two komorebi implementations.
This commit is contained in:
LGUG2Z committed 2026-02-07 14:50:20 -08:00
1 parent 6e324b63cc
commit ceba46f878
28 files changed
+228 -2275

No files matched your search

Generated
+38 -2
View File
@@ -1968,7 +1968,7 @@ dependencies = [
"palette",
"rand 0.7.3",
"serde",
"serde_yaml",
"serde_yaml 0.8.26",
"shell-words",
"shellexpand",
"toml",
@@ -3009,6 +3009,7 @@ dependencies = [
"dispatch2",
"ed25519-dalek",
"hotwatch",
"komorebi-layouts",
"komorebi-themes",
"lazy_static",
"nanoid",
@@ -3087,10 +3088,26 @@ dependencies = [
"serde_json_lenient",
]
[[package]]
name = "komorebi-layouts"
version = "0.1.40"
source = "git+https://github.com/LGUG2Z/komorebi?rev=b4f00fbc1257ab858aa4f45c06a8d3f176aee9a0#b4f00fbc1257ab858aa4f45c06a8d3f176aee9a0"
dependencies = [
"clap",
"color-eyre",
"objc2-core-foundation",
"schemars 1.2.1",
"serde",
"serde_json_lenient",
"serde_yaml 0.9.34+deprecated",
"strum",
"tracing",
]
[[package]]
name = "komorebi-themes"
version = "0.1.40"
source = "git+https://github.com/LGUG2Z/komorebi?rev=0758c7d9008a8e174ac35f469e53fd8fddd6b672#0758c7d9008a8e174ac35f469e53fd8fddd6b672"
source = "git+https://github.com/LGUG2Z/komorebi?rev=b4f00fbc1257ab858aa4f45c06a8d3f176aee9a0#b4f00fbc1257ab858aa4f45c06a8d3f176aee9a0"
dependencies = [
"base16-egui-themes",
"catppuccin-egui",
@@ -5455,6 +5472,19 @@ dependencies = [
"yaml-rust",
]
[[package]]
name = "serde_yaml"
version = "0.9.34+deprecated"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47"
dependencies = [
"indexmap 2.13.0",
"itoa",
"ryu",
"serde",
"unsafe-libyaml",
]
[[package]]
name = "servo-fontconfig"
version = "0.5.1"
@@ -6327,6 +6357,12 @@ version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
[[package]]
name = "unsafe-libyaml"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861"
[[package]]
name = "untrusted"
version = "0.9.0"
+5 -1
View File
@@ -13,7 +13,11 @@ members = [
version = "0.1.0"
[workspace.dependencies]
komorebi-themes = { git = "https://github.com/LGUG2Z/komorebi", rev = "0758c7d9008a8e174ac35f469e53fd8fddd6b672" }
komorebi-themes = { git = "https://github.com/LGUG2Z/komorebi", rev = "b4f00fbc1257ab858aa4f45c06a8d3f176aee9a0" }
komorebi-layouts = { git = "https://github.com/LGUG2Z/komorebi", rev = "b4f00fbc1257ab858aa4f45c06a8d3f176aee9a0", features = [
"darwin",
"schemars",
] }
chrono = "0.4"
chrono-tz = "0.10"
+5
View File
@@ -47,6 +47,11 @@ crate = "komorebi-client"
expression = "LicenseRef-Komorebi-2.0"
license-files = []
[[licenses.clarify]]
crate = "komorebi-layouts"
expression = "LicenseRef-Komorebi-2.0"
license-files = []
[[licenses.clarify]]
crate = "komorebic"
expression = "LicenseRef-Komorebi-2.0"
+6 -6
View File
@@ -4,23 +4,23 @@ pub use komorebi::NotificationEvent;
pub use komorebi::animation::AnimationPrefix;
pub use komorebi::container::Container;
pub use komorebi::core::ApplicationIdentifier;
pub use komorebi::core::Axis;
pub use komorebi::core::CycleDirection;
pub use komorebi::core::DefaultLayout;
pub use komorebi::core::Layout;
pub use komorebi::core::MoveBehaviour;
pub use komorebi::core::OperationBehaviour;
pub use komorebi::core::OperationDirection;
pub use komorebi::core::Rect;
pub use komorebi::core::Sizing;
pub use komorebi::core::SocketMessage;
pub use komorebi::core::StateQuery;
pub use komorebi::core::SubscribeOptions;
pub use komorebi::core::WindowKind;
pub use komorebi::core::animation::AnimationStyle;
pub use komorebi::core::arrangement::Axis;
pub use komorebi::core::asc::ApplicationSpecificConfiguration;
pub use komorebi::core::cycle_direction::CycleDirection;
pub use komorebi::core::default_layout::DefaultLayout;
pub use komorebi::core::layout::Layout;
pub use komorebi::core::operation_direction::OperationDirection;
pub use komorebi::core::pathext::PathExt;
pub use komorebi::core::pathext::replace_env_in_path;
pub use komorebi::core::rect::Rect;
pub use komorebi::monitor_reconciliator::MonitorNotification;
pub use komorebi::splash;
pub use komorebi::state::State;
+1
View File
@@ -6,6 +6,7 @@ edition = "2024"
[dependencies]
komorebi-themes = { workspace = true }
komorebi-layouts = { workspace = true }
quickxml_to_serde = { git = "https://github.com/LGUG2Z/quickxml_to_serde.git", version = "0.6.1" }
version = { path = "../version" }
+1 -1
View File
@@ -1,5 +1,5 @@
use crate::core::Rect;
use crate::core::animation::AnimationStyle;
use crate::core::rect::Rect;
use super::style::apply_ease_func;
+1 -1
View File
@@ -10,8 +10,8 @@ use crate::border_manager::BORDER_OFFSET_ADJUSTMENT;
use crate::border_manager::BORDER_WIDTH;
use crate::border_manager::ns_window::NsWindow;
use crate::border_manager::window_kind_colour;
use crate::core::Rect;
use crate::core::WindowKind;
use crate::core::rect::Rect;
use crate::core_graphics::CoreGraphicsApi;
use crate::macos_api::MacosApi;
use color_eyre::eyre;
File diff suppressed because it is too large. Load diff
-36
View File
@@ -1,36 +0,0 @@
use std::num::NonZeroUsize;
use clap::ValueEnum;
use serde::Deserialize;
use serde::Serialize;
use strum::Display;
use strum::EnumString;
#[derive(Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub enum CycleDirection {
Previous,
Next,
}
impl CycleDirection {
#[must_use]
pub const fn next_idx(&self, idx: usize, len: NonZeroUsize) -> usize {
match self {
Self::Previous => {
if idx == 0 {
len.get() - 1
} else {
idx - 1
}
}
Self::Next => {
if idx == len.get() - 1 {
0
} else {
idx + 1
}
}
}
}
}
-309
View File
@@ -1,309 +0,0 @@
use crate::core::Sizing;
use crate::core::operation_direction::OperationDirection;
use crate::core::rect::Rect;
use clap::ValueEnum;
use serde::Deserialize;
use serde::Serialize;
use strum::Display;
use strum::EnumString;
#[derive(
Clone, Copy, Debug, Serialize, Deserialize, Eq, PartialEq, Display, EnumString, ValueEnum,
)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema), schemars(extend("default" = Self::BSP)))]
/// A predefined komorebi layout
pub enum DefaultLayout {
/// BSP Layout
///
/// ```
/// +-------+-----+
/// | | |
/// | +--+--+
/// | | |--|
/// +-------+--+--+
/// ```
BSP,
/// Columns Layout
///
/// ```
/// +--+--+--+--+
/// | | | | |
/// | | | | |
/// | | | | |
/// +--+--+--+--+
/// ```
Columns,
/// Rows Layout
///
/// ```
/// +-----------+
/// |-----------|
/// |-----------|
/// |-----------|
/// +-----------+
/// ```
Rows,
/// Vertical Stack Layout
///
/// ```
/// +-------+-----+
/// | | |
/// | +-----+
/// | | |
/// +-------+-----+
/// ```
VerticalStack,
/// Horizontal Stack Layout
///
/// ```
/// +------+------+
/// | |
/// |------+------+
/// | | |
/// +------+------+
/// ```
HorizontalStack,
/// Ultrawide Vertical Stack Layout
///
/// ```
/// +-----+-----------+-----+
/// | | | |
/// | | +-----+
/// | | | |
/// | | +-----+
/// | | | |
/// +-----+-----------+-----+
/// ```
UltrawideVerticalStack,
/// Grid Layout
///
/// ```
/// +-----+-----+ +---+---+---+ +---+---+---+ +---+---+---+
///| | | | | | | | | | | | | | |
///| | | | | | | | | | | | | +---+
///+-----+-----+ | +---+---+ +---+---+---+ +---+---| |
///| | | | | | | | | | | | | +---+
///| | | | | | | | | | | | | | |
///+-----+-----+ +---+---+---+ +---+---+---+ +---+---+---+
/// 4 windows 5 windows 6 windows 7 windows
///```
Grid,
/// Right Main Vertical Stack Layout
///
/// ```
/// +-----+-------+
/// | | |
/// +-----+ |
/// | | |
/// +-----+-------+
/// ```
RightMainVerticalStack,
/// Scrolling Layout
///
/// ```
/// +--+--+--+--+--+--+
/// | | | |
/// | | | |
/// | | | |
/// +--+--+--+--+--+--+
/// ```
Scrolling,
// NOTE: If any new layout is added, please make sure to register the same in `DefaultLayout::cycle`
}
#[derive(Clone, Copy, Debug, Serialize, Deserialize, Eq, PartialEq)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
/// Options for specific layouts
pub struct LayoutOptions {
/// Options related to the Scrolling layout
pub scrolling: Option<ScrollingLayoutOptions>,
/// Options related to the Grid layout
pub grid: Option<GridLayoutOptions>,
}
#[derive(Clone, Copy, Debug, Serialize, Deserialize, Eq, PartialEq)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
/// Options for the Scrolling layout
pub struct ScrollingLayoutOptions {
/// Desired number of visible columns (default: 3)
pub columns: usize,
/// With an odd number of visible columns, keep the focused window column centered
pub center_focused_column: Option<bool>,
}
#[derive(Clone, Copy, Debug, Serialize, Deserialize, Eq, PartialEq)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
/// Options for the Grid layout
pub struct GridLayoutOptions {
/// Maximum number of rows per grid column
pub rows: usize,
}
impl DefaultLayout {
pub fn leftmost_index(&self, len: usize) -> usize {
match self {
Self::UltrawideVerticalStack | Self::RightMainVerticalStack => match len {
n if n > 1 => 1,
_ => 0,
},
Self::Scrolling => 0,
DefaultLayout::BSP
| DefaultLayout::Columns
| DefaultLayout::Rows
| DefaultLayout::VerticalStack
| DefaultLayout::HorizontalStack
| DefaultLayout::Grid => 0,
}
}
pub fn rightmost_index(&self, len: usize) -> usize {
match self {
DefaultLayout::BSP
| DefaultLayout::Columns
| DefaultLayout::Rows
| DefaultLayout::VerticalStack
| DefaultLayout::HorizontalStack
| DefaultLayout::Grid => len.saturating_sub(1),
DefaultLayout::UltrawideVerticalStack => match len {
2 => 0,
_ => len.saturating_sub(1),
},
DefaultLayout::RightMainVerticalStack => 0,
DefaultLayout::Scrolling => len.saturating_sub(1),
}
}
#[must_use]
#[allow(clippy::cast_precision_loss, clippy::only_used_in_recursion)]
pub fn resize(
&self,
unaltered: &Rect,
resize: &Option<Rect>,
edge: OperationDirection,
sizing: Sizing,
delta: i32,
) -> Option<Rect> {
if !matches!(
self,
Self::BSP
| Self::Columns
| Self::Rows
| Self::VerticalStack
| Self::RightMainVerticalStack
| Self::HorizontalStack
| Self::UltrawideVerticalStack
| Self::Scrolling
) {
return None;
};
let mut r = resize.unwrap_or_default();
let resize_delta = delta;
match edge {
OperationDirection::Left => match sizing {
Sizing::Increase => {
// Some final checks to make sure the user can't infinitely resize to
// the point of pushing other windows out of bounds
// Note: These checks cannot take into account the changes made to the
// edges of adjacent windows at operation time, so it is still possible
// to push windows out of bounds by maxing out an Increase Left on a
// Window with index 1, and then maxing out a Decrease Right on a Window
// with index 0. I don't think it's worth trying to defensively program
// against this; if people end up in this situation they are better off
// just hitting the retile command
let diff = ((r.left + -resize_delta) as f32).abs();
if diff < unaltered.right as f32 {
r.left += -resize_delta;
}
}
Sizing::Decrease => {
let diff = ((r.left - -resize_delta) as f32).abs();
if diff < unaltered.right as f32 {
r.left -= -resize_delta;
}
}
},
OperationDirection::Up => match sizing {
Sizing::Increase => {
let diff = ((r.top + resize_delta) as f32).abs();
if diff < unaltered.bottom as f32 {
r.top += -resize_delta;
}
}
Sizing::Decrease => {
let diff = ((r.top - resize_delta) as f32).abs();
if diff < unaltered.bottom as f32 {
r.top -= -resize_delta;
}
}
},
OperationDirection::Right => match sizing {
Sizing::Increase => {
let diff = ((r.right + resize_delta) as f32).abs();
if diff < unaltered.right as f32 {
r.right += resize_delta;
}
}
Sizing::Decrease => {
let diff = ((r.right - resize_delta) as f32).abs();
if diff < unaltered.right as f32 {
r.right -= resize_delta;
}
}
},
OperationDirection::Down => match sizing {
Sizing::Increase => {
let diff = ((r.bottom + resize_delta) as f32).abs();
if diff < unaltered.bottom as f32 {
r.bottom += resize_delta;
}
}
Sizing::Decrease => {
let diff = ((r.bottom - resize_delta) as f32).abs();
if diff < unaltered.bottom as f32 {
r.bottom -= resize_delta;
}
}
},
};
if r.eq(&Rect::default()) {
None
} else {
Option::from(r)
}
}
#[must_use]
pub const fn cycle_next(self) -> Self {
match self {
Self::BSP => Self::Columns,
Self::Columns => Self::Rows,
Self::Rows => Self::VerticalStack,
Self::VerticalStack => Self::HorizontalStack,
Self::HorizontalStack => Self::UltrawideVerticalStack,
Self::UltrawideVerticalStack => Self::Grid,
Self::Grid => Self::RightMainVerticalStack,
Self::RightMainVerticalStack => Self::Scrolling,
Self::Scrolling => Self::BSP,
}
}
#[must_use]
pub const fn cycle_previous(self) -> Self {
match self {
Self::Scrolling => Self::RightMainVerticalStack,
Self::RightMainVerticalStack => Self::Grid,
Self::Grid => Self::UltrawideVerticalStack,
Self::UltrawideVerticalStack => Self::HorizontalStack,
Self::HorizontalStack => Self::VerticalStack,
Self::VerticalStack => Self::Rows,
Self::Rows => Self::Columns,
Self::Columns => Self::BSP,
Self::BSP => Self::RightMainVerticalStack,
}
}
}
-397
View File
@@ -1,397 +0,0 @@
use crate::core::default_layout::DefaultLayout;
use crate::core::default_layout::LayoutOptions;
use crate::core::operation_direction::OperationDirection;
pub trait Direction {
fn index_in_direction(
&self,
op_direction: OperationDirection,
idx: usize,
count: usize,
layout_options: Option<LayoutOptions>,
) -> Option<usize>;
fn is_valid_direction(
&self,
op_direction: OperationDirection,
idx: usize,
count: usize,
layout_options: Option<LayoutOptions>,
) -> bool;
fn up_index(
&self,
op_direction: Option<OperationDirection>,
idx: usize,
count: Option<usize>,
layout_options: Option<LayoutOptions>,
) -> usize;
fn down_index(
&self,
op_direction: Option<OperationDirection>,
idx: usize,
count: Option<usize>,
layout_options: Option<LayoutOptions>,
) -> usize;
fn left_index(
&self,
op_direction: Option<OperationDirection>,
idx: usize,
count: Option<usize>,
layout_options: Option<LayoutOptions>,
) -> usize;
fn right_index(
&self,
op_direction: Option<OperationDirection>,
idx: usize,
count: Option<usize>,
layout_options: Option<LayoutOptions>,
) -> usize;
}
impl Direction for DefaultLayout {
fn index_in_direction(
&self,
op_direction: OperationDirection,
idx: usize,
count: usize,
layout_options: Option<LayoutOptions>,
) -> Option<usize> {
match op_direction {
OperationDirection::Left => {
if self.is_valid_direction(op_direction, idx, count, layout_options) {
Option::from(self.left_index(
Some(op_direction),
idx,
Some(count),
layout_options,
))
} else {
None
}
}
OperationDirection::Right => {
if self.is_valid_direction(op_direction, idx, count, layout_options) {
Option::from(self.right_index(
Some(op_direction),
idx,
Some(count),
layout_options,
))
} else {
None
}
}
OperationDirection::Up => {
if self.is_valid_direction(op_direction, idx, count, layout_options) {
Option::from(self.up_index(
Some(op_direction),
idx,
Some(count),
layout_options,
))
} else {
None
}
}
OperationDirection::Down => {
if self.is_valid_direction(op_direction, idx, count, layout_options) {
Option::from(self.down_index(
Some(op_direction),
idx,
Some(count),
layout_options,
))
} else {
None
}
}
}
}
fn is_valid_direction(
&self,
op_direction: OperationDirection,
idx: usize,
count: usize,
layout_options: Option<LayoutOptions>,
) -> bool {
if count < 2 {
return false;
}
match op_direction {
OperationDirection::Up => match self {
Self::BSP => idx != 0 && idx != 1,
Self::Columns => false,
Self::Rows | Self::HorizontalStack => idx != 0,
Self::VerticalStack | Self::RightMainVerticalStack => idx != 0 && idx != 1,
Self::UltrawideVerticalStack => idx > 2,
Self::Grid => !is_grid_edge(op_direction, idx, count, layout_options),
Self::Scrolling => false,
},
OperationDirection::Down => match self {
Self::BSP => idx != count - 1 && !idx.is_multiple_of(2),
Self::Columns => false,
Self::Rows => idx != count - 1,
Self::VerticalStack | Self::RightMainVerticalStack => idx != 0 && idx != count - 1,
Self::HorizontalStack => idx == 0,
Self::UltrawideVerticalStack => idx > 1 && idx != count - 1,
Self::Grid => !is_grid_edge(op_direction, idx, count, layout_options),
Self::Scrolling => false,
},
OperationDirection::Left => match self {
Self::BSP => idx != 0,
Self::Columns | Self::VerticalStack => idx != 0,
Self::RightMainVerticalStack => idx == 0,
Self::Rows => false,
Self::HorizontalStack => idx != 0 && idx != 1,
Self::UltrawideVerticalStack => idx != 1,
Self::Grid => !is_grid_edge(op_direction, idx, count, layout_options),
Self::Scrolling => idx != 0,
},
OperationDirection::Right => match self {
Self::BSP => idx.is_multiple_of(2) && idx != count - 1,
Self::Columns => idx != count - 1,
Self::Rows => false,
Self::VerticalStack => idx == 0,
Self::RightMainVerticalStack => idx != 0,
Self::HorizontalStack => idx != 0 && idx != count - 1,
Self::UltrawideVerticalStack => match count {
2 => idx != 0,
_ => idx < 2,
},
Self::Grid => !is_grid_edge(op_direction, idx, count, layout_options),
Self::Scrolling => idx != count - 1,
},
}
}
fn up_index(
&self,
op_direction: Option<OperationDirection>,
idx: usize,
count: Option<usize>,
layout_options: Option<LayoutOptions>,
) -> usize {
match self {
Self::BSP => {
if idx.is_multiple_of(2) {
idx - 1
} else {
idx - 2
}
}
Self::Columns => unreachable!(),
Self::Rows
| Self::VerticalStack
| Self::UltrawideVerticalStack
| Self::RightMainVerticalStack => idx - 1,
Self::HorizontalStack => 0,
Self::Grid => grid_neighbor(op_direction, idx, count, layout_options),
Self::Scrolling => unreachable!(),
}
}
fn down_index(
&self,
op_direction: Option<OperationDirection>,
idx: usize,
count: Option<usize>,
layout_options: Option<LayoutOptions>,
) -> usize {
match self {
Self::BSP
| Self::Rows
| Self::VerticalStack
| Self::UltrawideVerticalStack
| Self::RightMainVerticalStack => idx + 1,
Self::Columns => unreachable!(),
Self::HorizontalStack => 1,
Self::Grid => grid_neighbor(op_direction, idx, count, layout_options),
Self::Scrolling => unreachable!(),
}
}
fn left_index(
&self,
op_direction: Option<OperationDirection>,
idx: usize,
count: Option<usize>,
layout_options: Option<LayoutOptions>,
) -> usize {
match self {
Self::BSP => {
if idx.is_multiple_of(2) {
idx - 2
} else {
idx - 1
}
}
Self::Columns | Self::HorizontalStack => idx - 1,
Self::Rows => unreachable!(),
Self::VerticalStack => 0,
Self::RightMainVerticalStack => 1,
Self::UltrawideVerticalStack => match idx {
0 => 1,
1 => unreachable!(),
_ => 0,
},
Self::Grid => grid_neighbor(op_direction, idx, count, layout_options),
Self::Scrolling => idx - 1,
}
}
fn right_index(
&self,
op_direction: Option<OperationDirection>,
idx: usize,
count: Option<usize>,
layout_options: Option<LayoutOptions>,
) -> usize {
match self {
Self::BSP | Self::Columns | Self::HorizontalStack => idx + 1,
Self::Rows => unreachable!(),
Self::VerticalStack => 1,
Self::RightMainVerticalStack => 0,
Self::UltrawideVerticalStack => match idx {
1 => 0,
0 => 2,
_ => unreachable!(),
},
Self::Grid => grid_neighbor(op_direction, idx, count, layout_options),
Self::Scrolling => idx + 1,
}
}
}
struct GridItem {
state: GridItemState,
row: usize,
num_rows: usize,
touching_edges: GridTouchingEdges,
}
enum GridItemState {
Valid,
Invalid,
}
#[allow(clippy::struct_excessive_bools)]
struct GridTouchingEdges {
left: bool,
right: bool,
up: bool,
down: bool,
}
#[allow(
clippy::cast_possible_truncation,
clippy::cast_precision_loss,
clippy::cast_sign_loss
)]
fn get_grid_item(idx: usize, count: usize, layout_options: Option<LayoutOptions>) -> GridItem {
let row_constraint = layout_options.and_then(|o| o.grid.map(|g| g.rows));
let num_cols = if let Some(rows) = row_constraint {
((count as f32) / (rows as f32)).ceil() as i32
} else {
(count as f32).sqrt().ceil() as i32
};
let mut iter = 0;
for col in 0..num_cols {
let remaining_windows = (count - iter) as i32;
let remaining_columns = num_cols - col;
let num_rows_in_this_col = if let Some(rows) = row_constraint {
(remaining_windows / remaining_columns).min(rows as i32)
} else {
remaining_windows / remaining_columns
};
for row in 0..num_rows_in_this_col {
if iter == idx {
return GridItem {
state: GridItemState::Valid,
row: (row + 1) as usize,
num_rows: num_rows_in_this_col as usize,
touching_edges: GridTouchingEdges {
left: col == 0,
right: col == num_cols - 1,
up: row == 0,
down: row == num_rows_in_this_col - 1,
},
};
}
iter += 1;
}
}
GridItem {
state: GridItemState::Invalid,
row: 0,
num_rows: 0,
touching_edges: GridTouchingEdges {
left: true,
right: true,
up: true,
down: true,
},
}
}
fn is_grid_edge(
op_direction: OperationDirection,
idx: usize,
count: usize,
layout_options: Option<LayoutOptions>,
) -> bool {
let item = get_grid_item(idx, count, layout_options);
match item.state {
GridItemState::Invalid => false,
GridItemState::Valid => match op_direction {
OperationDirection::Left => item.touching_edges.left,
OperationDirection::Right => item.touching_edges.right,
OperationDirection::Up => item.touching_edges.up,
OperationDirection::Down => item.touching_edges.down,
},
}
}
fn grid_neighbor(
op_direction: Option<OperationDirection>,
idx: usize,
count: Option<usize>,
layout_options: Option<LayoutOptions>,
) -> usize {
let Some(op_direction) = op_direction else {
return 0;
};
let Some(count) = count else {
return 0;
};
let item = get_grid_item(idx, count, layout_options);
match op_direction {
OperationDirection::Left => {
let item_from_prev_col = get_grid_item(idx - item.row, count, layout_options);
if item.touching_edges.up && item.num_rows != item_from_prev_col.num_rows {
return idx - (item.num_rows - 1);
}
if item.num_rows != item_from_prev_col.num_rows && !item.touching_edges.down {
return idx - (item.num_rows - 1);
}
idx - item.num_rows
}
OperationDirection::Right => idx + item.num_rows,
OperationDirection::Up => idx - 1,
OperationDirection::Down => idx + 1,
}
}
-29
View File
@@ -1,29 +0,0 @@
use crate::core::arrangement::Arrangement;
use crate::core::default_layout::DefaultLayout;
use crate::core::direction::Direction;
use serde::Deserialize;
use serde::Serialize;
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
/// A komorebi layout
pub enum Layout {
/// A predefined komorebi layout
Default(DefaultLayout),
}
impl Layout {
#[must_use]
pub fn as_boxed_direction(&self) -> Box<dyn Direction> {
match self {
Layout::Default(layout) => Box::new(*layout),
}
}
#[must_use]
pub fn as_boxed_arrangement(&self) -> Box<dyn Arrangement> {
match self {
Layout::Default(layout) => Box::new(*layout),
}
}
}
+21 -35
View File
@@ -1,11 +1,6 @@
use crate::animation::AnimationPrefix;
use crate::core::animation::AnimationStyle;
use crate::core::arrangement::Axis;
use crate::core::cycle_direction::CycleDirection;
use crate::core::default_layout::DefaultLayout;
use crate::core::operation_direction::OperationDirection;
use crate::core::pathext::ResolvedPathBuf;
use crate::core::rect::Rect;
use clap::ValueEnum;
use color_eyre::eyre;
use komorebi_themes::KomorebiTheme;
@@ -17,17 +12,31 @@ use std::str::FromStr;
use strum::Display;
use strum::EnumString;
// Re-export types from komorebi-layouts
pub use komorebi_layouts::Arrangement;
pub use komorebi_layouts::Axis;
pub use komorebi_layouts::CycleDirection;
pub use komorebi_layouts::DEFAULT_RATIO;
pub use komorebi_layouts::DEFAULT_SECONDARY_RATIO;
pub use komorebi_layouts::DefaultLayout;
pub use komorebi_layouts::Direction;
pub use komorebi_layouts::GridLayoutOptions;
pub use komorebi_layouts::Layout;
pub use komorebi_layouts::LayoutOptions;
pub use komorebi_layouts::MAX_RATIO;
pub use komorebi_layouts::MAX_RATIOS;
pub use komorebi_layouts::MIN_RATIO;
pub use komorebi_layouts::OperationDirection;
pub use komorebi_layouts::Rect;
pub use komorebi_layouts::ScrollingLayoutOptions;
pub use komorebi_layouts::Sizing;
// Keep local modules that aren't in komorebi-layouts
pub mod animation;
pub mod arrangement;
pub mod asc;
pub mod config_generation;
pub mod cycle_direction;
pub mod default_layout;
pub mod direction;
pub mod layout;
pub mod operation_direction;
pub mod pathext;
pub mod rect;
pub mod rect_ext;
#[derive(
Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize, Display, EnumString, ValueEnum,
@@ -42,29 +51,6 @@ pub enum OperationBehaviour {
NoOp,
}
#[derive(Clone, Copy, Debug, Serialize, Deserialize, Display, EnumString, ValueEnum)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub enum Sizing {
Increase,
Decrease,
}
impl Sizing {
#[must_use]
pub const fn adjust_by(&self, value: i32, adjustment: i32) -> i32 {
match self {
Self::Increase => value + adjustment,
Self::Decrease => {
if value > 0 && value - adjustment >= 0 {
value - adjustment
} else {
value
}
}
}
}
}
#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize, PartialEq)]
pub struct WindowManagementBehaviour {
/// The current WindowContainerBehaviour to be used
-61
View File
@@ -1,61 +0,0 @@
use crate::core::arrangement::Axis;
use crate::core::default_layout::LayoutOptions;
use crate::core::direction::Direction;
use clap::ValueEnum;
use serde::Deserialize;
use serde::Serialize;
use std::num::NonZeroUsize;
#[derive(Clone, Copy, Debug, Serialize, Deserialize, ValueEnum)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub enum OperationDirection {
Left,
Right,
Up,
Down,
}
impl OperationDirection {
#[must_use]
pub const fn opposite(self) -> Self {
match self {
Self::Left => Self::Right,
Self::Right => Self::Left,
Self::Up => Self::Down,
Self::Down => Self::Up,
}
}
fn flip(self, layout_flip: Option<Axis>) -> Self {
layout_flip.map_or(self, |flip| match self {
Self::Left => match flip {
Axis::Horizontal | Axis::HorizontalAndVertical => Self::Right,
Axis::Vertical => self,
},
Self::Right => match flip {
Axis::Horizontal | Axis::HorizontalAndVertical => Self::Left,
Axis::Vertical => self,
},
Self::Up => match flip {
Axis::Vertical | Axis::HorizontalAndVertical => Self::Down,
Axis::Horizontal => self,
},
Self::Down => match flip {
Axis::Vertical | Axis::HorizontalAndVertical => Self::Up,
Axis::Horizontal => self,
},
})
}
#[must_use]
pub fn destination(
self,
layout: &dyn Direction,
layout_flip: Option<Axis>,
idx: usize,
len: NonZeroUsize,
layout_options: Option<LayoutOptions>,
) -> Option<usize> {
layout.index_in_direction(self.flip(layout_flip), idx, len.get(), layout_options)
}
}
-126
View File
@@ -1,126 +0,0 @@
use crate::core_graphics::CoreGraphicsApi;
use crate::window::WindowBounds;
use objc2_core_foundation::CGFloat;
use objc2_core_foundation::CGPoint;
use objc2_core_foundation::CGRect;
use objc2_core_foundation::CGSize;
use serde::Deserialize;
use serde::Serialize;
#[derive(Debug, Default, Copy, Clone, Serialize, Deserialize, PartialEq)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
/// Rectangle dimensions
pub struct Rect {
/// Left point of the rectangle
pub left: i32,
/// Top point of the rectangle
pub top: i32,
/// Width of the recentangle (from the left point)
pub right: i32,
/// Height of the rectangle (from the top point)
pub bottom: i32,
}
impl From<CGSize> for Rect {
fn from(value: CGSize) -> Self {
Self {
left: 0,
top: 0,
right: value.width as i32,
bottom: value.height as i32,
}
}
}
impl From<CGRect> for Rect {
fn from(value: CGRect) -> Self {
Self {
left: value.origin.x as i32,
top: value.origin.y as i32,
right: value.size.width as i32,
bottom: value.size.height as i32,
}
}
}
impl From<&Rect> for CGRect {
fn from(value: &Rect) -> Self {
Self {
origin: CGPoint {
x: value.left as CGFloat,
y: value.top as CGFloat,
},
size: CGSize {
width: value.right as CGFloat,
height: value.bottom as CGFloat,
},
}
}
}
impl From<WindowBounds> for Rect {
fn from(value: WindowBounds) -> Self {
Self {
left: value.x as i32,
top: value.y as i32,
right: value.width as i32,
bottom: value.height as i32,
}
}
}
impl Rect {
pub fn contains(&self, other: &Rect) -> bool {
CoreGraphicsApi::contains_rect(other.into(), self.into())
}
pub fn percentage_within_horizontal_bounds(&self, other: &Rect) -> f64 {
let overlap_left = self.left.max(other.left);
let overlap_right = (self.left + self.right).min(other.left + other.right);
let overlap_width = overlap_right - overlap_left;
if overlap_width <= 0 {
0.0
} else {
(overlap_width as f64) / (other.right as f64) * 100.0
}
}
/// Decrease the size of self by the padding amount.
pub fn add_padding<T>(&mut self, padding: T)
where
T: Into<Option<i32>>,
{
if let Some(padding) = padding.into() {
self.left += padding;
self.top += padding;
self.right -= padding * 2;
self.bottom -= padding * 2;
}
}
/// Increase the size of self by the margin amount.
pub fn add_margin(&mut self, margin: i32) {
self.left -= margin;
self.top -= margin;
self.right += margin * 2;
self.bottom += margin * 2;
}
pub fn left_padding(&mut self, padding: i32) {
self.left += padding;
}
pub fn right_padding(&mut self, padding: i32) {
self.right -= padding;
}
#[must_use]
pub const fn contains_point(&self, point: (i32, i32)) -> bool {
point.0 >= self.left
&& point.0 <= self.left + self.right
&& point.1 >= self.top
&& point.1 <= self.top + self.bottom
}
}
+2 -1
View File
@@ -10,7 +10,8 @@ use crate::accessibility::error::AccessibilityError;
use crate::application::Application;
use crate::cf_array_as;
use crate::container::Container;
use crate::core::rect::Rect;
use crate::core::Rect;
use crate::core::rect_ext::RectExt;
use crate::core_graphics::CoreGraphicsApi;
use crate::ioreg::IoReg;
use crate::monitor::Monitor;
+4 -4
View File
@@ -1,12 +1,12 @@
use crate::DEFAULT_CONTAINER_PADDING;
use crate::DEFAULT_WORKSPACE_PADDING;
use crate::container::Container;
use crate::core::DefaultLayout;
use crate::core::FloatingLayerBehaviour;
use crate::core::Layout;
use crate::core::OperationDirection;
use crate::core::Rect;
use crate::core::WindowHidingPosition;
use crate::core::default_layout::DefaultLayout;
use crate::core::layout::Layout;
use crate::core::operation_direction::OperationDirection;
use crate::core::rect::Rect;
use crate::macos_api::MacosApi;
use crate::ring::Ring;
use crate::static_config::Wallpaper;
+9 -7
View File
@@ -21,21 +21,21 @@ use crate::application::Application;
use crate::border_manager;
use crate::cf_array_as;
use crate::core::ApplicationIdentifier;
use crate::core::Axis;
use crate::core::Layout;
use crate::core::LayoutOptions;
use crate::core::MoveBehaviour;
use crate::core::OperationDirection;
use crate::core::Rect;
use crate::core::ScrollingLayoutOptions;
use crate::core::SocketMessage;
use crate::core::StateQuery;
use crate::core::WindowContainerBehaviour;
use crate::core::WindowKind;
use crate::core::arrangement::Axis;
use crate::core::config_generation::IdWithIdentifier;
use crate::core::config_generation::MatchingRule;
use crate::core::config_generation::MatchingStrategy;
use crate::core::config_generation::WorkspaceMatchingRule;
use crate::core::default_layout::LayoutOptions;
use crate::core::default_layout::ScrollingLayoutOptions;
use crate::core::layout::Layout;
use crate::core::operation_direction::OperationDirection;
use crate::core::rect::Rect;
use crate::core_graphics::CoreGraphicsApi;
use crate::current_space_id;
use crate::macos_api::MacosApi;
@@ -1513,6 +1513,8 @@ impl WindowManager {
center_focused_column: Default::default(),
}),
grid: None,
column_ratios: None,
row_ratios: None,
},
};
@@ -1871,7 +1873,7 @@ pub fn read_commands_uds(
mod tests {
use crate::SocketMessage;
use crate::WindowManagerEvent;
use crate::core::rect::Rect;
use crate::core::Rect;
use crate::monitor;
use crate::window_manager::WindowManager;
use crossbeam_channel::Receiver;
+4 -4
View File
@@ -11,14 +11,14 @@ use crate::accessibility::error::AccessibilityApiError;
use crate::accessibility::error::AccessibilityError;
use crate::accessibility::notification_constants::AccessibilityNotification;
use crate::border_manager;
use crate::core::DefaultLayout;
use crate::core::Layout;
use crate::core::OperationDirection;
use crate::core::Rect;
use crate::core::Sizing;
use crate::core::WindowContainerBehaviour;
use crate::core::WindowHidingPosition;
use crate::core::config_generation::MatchingRule;
use crate::core::default_layout::DefaultLayout;
use crate::core::layout::Layout;
use crate::core::operation_direction::OperationDirection;
use crate::core::rect::Rect;
use crate::current_space_id;
use crate::macos_api::MacosApi;
use crate::notify_subscribers;
+1 -1
View File
@@ -6,10 +6,10 @@ use crate::MANAGE_IDENTIFIERS;
use crate::WORKSPACE_MATCHING_RULES;
use crate::core::MoveBehaviour;
use crate::core::OperationBehaviour;
use crate::core::Rect;
use crate::core::WindowContainerBehaviour;
use crate::core::config_generation::MatchingRule;
use crate::core::config_generation::WorkspaceMatchingRule;
use crate::core::rect::Rect;
use crate::monitor::Monitor;
use crate::ring::Ring;
use crate::window_manager::WindowManager;
+5 -5
View File
@@ -24,27 +24,27 @@ use crate::animation::DEFAULT_ANIMATION_FPS;
use crate::animation::PerAnimationPrefixConfig;
use crate::border_manager;
use crate::core::ApplicationIdentifier;
use crate::core::Axis;
use crate::core::CrossBoundaryBehaviour;
use crate::core::DefaultLayout;
use crate::core::FloatingLayerBehaviour;
use crate::core::Layout;
use crate::core::LayoutOptions;
use crate::core::MoveBehaviour;
use crate::core::OperationBehaviour;
use crate::core::Placement;
use crate::core::Rect;
use crate::core::SocketMessage;
use crate::core::WindowContainerBehaviour;
use crate::core::WindowHidingPosition;
use crate::core::WindowManagementBehaviour;
use crate::core::animation::AnimationStyle;
use crate::core::arrangement::Axis;
use crate::core::asc::ApplicationSpecificConfiguration;
use crate::core::asc::AscApplicationRulesOrSchema;
use crate::core::config_generation::MatchingRule;
use crate::core::config_generation::MatchingStrategy;
use crate::core::config_generation::WorkspaceMatchingRule;
use crate::core::default_layout::DefaultLayout;
use crate::core::default_layout::LayoutOptions;
use crate::core::layout::Layout;
use crate::core::pathext::ResolvedPathBuf;
use crate::core::rect::Rect;
use crate::current_space_id;
use crate::monitor;
use crate::monitor::Monitor;
+1 -1
View File
@@ -46,12 +46,12 @@ use crate::animation::prefix::new_animation_key;
use crate::application::Application;
use crate::cf_dictionary_value;
use crate::core::ApplicationIdentifier;
use crate::core::Rect;
use crate::core::WindowHidingPosition;
use crate::core::animation::AnimationStyle;
use crate::core::config_generation::IdWithIdentifier;
use crate::core::config_generation::MatchingRule;
use crate::core::config_generation::MatchingStrategy;
use crate::core::rect::Rect;
use crate::core_graphics::CoreGraphicsApi;
use crate::hidden_frame_bottom_left;
use crate::hidden_frame_bottom_right;
+7 -7
View File
@@ -9,22 +9,22 @@ use crate::accessibility::AccessibilityApi;
use crate::application::Application;
use crate::border_manager;
use crate::container::Container;
use crate::core::Arrangement;
use crate::core::Axis;
use crate::core::CrossBoundaryBehaviour;
use crate::core::CycleDirection;
use crate::core::DefaultLayout;
use crate::core::Layout;
use crate::core::MoveBehaviour;
use crate::core::OperationBehaviour;
use crate::core::OperationDirection;
use crate::core::Placement;
use crate::core::Rect;
use crate::core::Sizing;
use crate::core::WindowContainerBehaviour;
use crate::core::WindowHidingPosition;
use crate::core::WindowManagementBehaviour;
use crate::core::arrangement::Arrangement;
use crate::core::arrangement::Axis;
use crate::core::config_generation::MatchingRule;
use crate::core::cycle_direction::CycleDirection;
use crate::core::default_layout::DefaultLayout;
use crate::core::layout::Layout;
use crate::core::operation_direction::OperationDirection;
use crate::core::rect::Rect;
use crate::current_space_id;
use crate::lockable_sequence::Lockable;
use crate::macos_api::MacosApi;
+7 -7
View File
@@ -1,16 +1,16 @@
use crate::DATA_DIR;
use crate::container::Container;
use crate::core::Axis;
use crate::core::CycleDirection;
use crate::core::DefaultLayout;
use crate::core::FloatingLayerBehaviour;
use crate::core::Layout;
use crate::core::LayoutOptions;
use crate::core::OperationDirection;
use crate::core::Rect;
use crate::core::SocketMessage;
use crate::core::WindowContainerBehaviour;
use crate::core::WindowHidingPosition;
use crate::core::arrangement::Axis;
use crate::core::cycle_direction::CycleDirection;
use crate::core::default_layout::DefaultLayout;
use crate::core::default_layout::LayoutOptions;
use crate::core::layout::Layout;
use crate::core::operation_direction::OperationDirection;
use crate::core::rect::Rect;
use crate::lockable_sequence::LockableSequence;
use crate::macos_api::MacosApi;
use crate::ring::Ring;
+12 -12
View File
@@ -965,17 +965,6 @@ in
]
);
};
auto_select_text = lib.mkOption {
type = (
lib.types.nullOr (
lib.types.oneOf [
(lib.types.nullOr catppuccinValue)
(lib.types.nullOr base16Value)
]
)
);
default = null;
};
colours = lib.mkOption {
type = (
lib.types.nullOr (
@@ -1051,6 +1040,17 @@ in
);
default = null;
};
auto_select_fill = lib.mkOption {
type = (
lib.types.nullOr (
lib.types.oneOf [
(lib.types.nullOr catppuccinValue)
(lib.types.nullOr base16Value)
]
)
);
default = null;
};
accent = lib.mkOption {
type = (
lib.types.nullOr (
@@ -1348,7 +1348,7 @@ in
);
default = null;
};
auto_select_fill = lib.mkOption {
auto_select_text = lib.mkOption {
type = (
lib.types.nullOr (
lib.types.oneOf [
+45 -35
View File
@@ -647,6 +647,11 @@ in
lib.types.nullOr (
lib.types.submodule {
options = {
column_ratios = lib.mkOption {
type = (lib.types.nullOr (lib.types.listOf (lib.types.nullOr lib.types.number)));
default = null;
description = "Column width ratios (up to MAX_RATIOS values between 0.1 and 0.9)\n\n- Used by Columns layout: ratios for each column width\n- Used by Grid layout: ratios for column widths\n- Used by BSP, VerticalStack, RightMainVerticalStack: column_ratios[0] as primary split ratio\n- Used by HorizontalStack: column_ratios[0] as primary split ratio (top area height)\n- Used by UltrawideVerticalStack: column_ratios[0] as center ratio, column_ratios[1] as left ratio\n\nColumns without a ratio share remaining space equally.\nExample: `[0.3, 0.4, 0.3]` for 30%-40%-30% columns";
};
grid = lib.mkOption {
type = (
lib.types.nullOr (
@@ -663,6 +668,11 @@ in
default = null;
description = "Options related to the Grid layout";
};
row_ratios = lib.mkOption {
type = (lib.types.nullOr (lib.types.listOf (lib.types.nullOr lib.types.number)));
default = null;
description = "Row height ratios (up to MAX_RATIOS values between 0.1 and 0.9)\n\n- Used by Rows layout: ratios for each row height\n- Used by Grid layout: ratios for row heights\n\nRows without a ratio share remaining space equally.\nExample: `[0.5, 0.5]` for 50%-50% rows";
};
scrolling = lib.mkOption {
type = (
lib.types.nullOr (
@@ -789,7 +799,29 @@ in
);
default = null;
};
bar_accent = lib.mkOption {
stack_border = lib.mkOption {
type = (
lib.types.nullOr (
lib.types.oneOf [
(lib.types.nullOr catppuccinValue)
(lib.types.nullOr base16Value)
]
)
);
default = null;
};
single_border = lib.mkOption {
type = (
lib.types.nullOr (
lib.types.oneOf [
(lib.types.nullOr catppuccinValue)
(lib.types.nullOr base16Value)
]
)
);
default = null;
};
unfocused_border = lib.mkOption {
type = (
lib.types.nullOr (
lib.types.oneOf [
@@ -1097,39 +1129,6 @@ in
);
default = null;
};
stack_border = lib.mkOption {
type = (
lib.types.nullOr (
lib.types.oneOf [
(lib.types.nullOr catppuccinValue)
(lib.types.nullOr base16Value)
]
)
);
default = null;
};
monocle_border = lib.mkOption {
type = (
lib.types.nullOr (
lib.types.oneOf [
(lib.types.nullOr catppuccinValue)
(lib.types.nullOr base16Value)
]
)
);
default = null;
};
single_border = lib.mkOption {
type = (
lib.types.nullOr (
lib.types.oneOf [
(lib.types.nullOr catppuccinValue)
(lib.types.nullOr base16Value)
]
)
);
default = null;
};
colours = lib.mkOption {
type = (
lib.types.nullOr (
@@ -1205,7 +1204,18 @@ in
);
default = null;
};
unfocused_border = lib.mkOption {
bar_accent = lib.mkOption {
type = (
lib.types.nullOr (
lib.types.oneOf [
(lib.types.nullOr catppuccinValue)
(lib.types.nullOr base16Value)
]
)
);
default = null;
};
monocle_border = lib.mkOption {
type = (
lib.types.nullOr (
lib.types.oneOf [
+9 -10
View File
@@ -2196,50 +2196,49 @@
},
"DefaultLayout": {
"description": "A predefined komorebi layout",
"default": "BSP",
"oneOf": [
{
"description": "BSP Layout\n\n```\n+-------+-----+\n| | |\n| +--+--+\n| | |--|\n+-------+--+--+\n```",
"description": "BSP Layout\n\n```text\n+-------+-----+\n| | |\n| +--+--+\n| | |--|\n+-------+--+--+\n```",
"type": "string",
"const": "BSP"
},
{
"description": "Columns Layout\n\n```\n+--+--+--+--+\n| | | | |\n| | | | |\n| | | | |\n+--+--+--+--+\n```",
"description": "Columns Layout\n\n```text\n+--+--+--+--+\n| | | | |\n| | | | |\n| | | | |\n+--+--+--+--+\n```",
"type": "string",
"const": "Columns"
},
{
"description": "Rows Layout\n\n```\n+-----------+\n|-----------|\n|-----------|\n|-----------|\n+-----------+\n```",
"description": "Rows Layout\n\n```text\n+-----------+\n|-----------|\n|-----------|\n|-----------|\n+-----------+\n```",
"type": "string",
"const": "Rows"
},
{
"description": "Vertical Stack Layout\n\n```\n+-------+-----+\n| | |\n| +-----+\n| | |\n+-------+-----+\n```",
"description": "Vertical Stack Layout\n\n```text\n+-------+-----+\n| | |\n| +-----+\n| | |\n+-------+-----+\n```",
"type": "string",
"const": "VerticalStack"
},
{
"description": "Horizontal Stack Layout\n\n```\n+------+------+\n| |\n|------+------+\n| | |\n+------+------+\n```",
"description": "Horizontal Stack Layout\n\n```text\n+------+------+\n| |\n|------+------+\n| | |\n+------+------+\n```",
"type": "string",
"const": "HorizontalStack"
},
{
"description": "Ultrawide Vertical Stack Layout\n\n```\n+-----+-----------+-----+\n| | | |\n| | +-----+\n| | | |\n| | +-----+\n| | | |\n+-----+-----------+-----+\n```",
"description": "Ultrawide Vertical Stack Layout\n\n```text\n+-----+-----------+-----+\n| | | |\n| | +-----+\n| | | |\n| | +-----+\n| | | |\n+-----+-----------+-----+\n```",
"type": "string",
"const": "UltrawideVerticalStack"
},
{
"description": "Grid Layout\n\n```\n+-----+-----+ +---+---+---+ +---+---+---+ +---+---+---+\n| | | | | | | | | | | | | | |\n| | | | | | | | | | | | | +---+\n+-----+-----+ | +---+---+ +---+---+---+ +---+---| |\n| | | | | | | | | | | | | +---+\n| | | | | | | | | | | | | | |\n+-----+-----+ +---+---+---+ +---+---+---+ +---+---+---+\n 4 windows 5 windows 6 windows 7 windows\n```",
"description": "Grid Layout\n\n```text\n+-----+-----+ +---+---+---+ +---+---+---+ +---+---+---+\n| | | | | | | | | | | | | | |\n| | | | | | | | | | | | | +---+\n+-----+-----+ | +---+---+ +---+---+---+ +---+---| |\n| | | | | | | | | | | | | +---+\n| | | | | | | | | | | | | | |\n+-----+-----+ +---+---+---+ +---+---+---+ +---+---+---+\n 4 windows 5 windows 6 windows 7 windows\n```",
"type": "string",
"const": "Grid"
},
{
"description": "Right Main Vertical Stack Layout\n\n```\n+-----+-------+\n| | |\n+-----+ |\n| | |\n+-----+-------+\n```",
"description": "Right Main Vertical Stack Layout\n\n```text\n+-----+-------+\n| | |\n+-----+ |\n| | |\n+-----+-------+\n```",
"type": "string",
"const": "RightMainVerticalStack"
},
{
"description": "Scrolling Layout\n\n```\n+--+--+--+--+--+--+\n| | | |\n| | | |\n| | | |\n+--+--+--+--+--+--+\n```",
"description": "Scrolling Layout\n\n```text\n+--+--+--+--+--+--+\n| | | |\n| | | |\n| | | |\n+--+--+--+--+--+--+\n```",
"type": "string",
"const": "Scrolling"
}
+44 -11
View File
@@ -640,7 +640,7 @@
]
},
"Axis": {
"description": "An axis on which to perform an operation",
"description": "Axis on which to perform an operation",
"oneOf": [
{
"description": "Horizontal axis",
@@ -2444,50 +2444,49 @@
},
"DefaultLayout": {
"description": "A predefined komorebi layout",
"default": "BSP",
"oneOf": [
{
"description": "BSP Layout\n\n```\n+-------+-----+\n| | |\n| +--+--+\n| | |--|\n+-------+--+--+\n```",
"description": "BSP Layout\n\n```text\n+-------+-----+\n| | |\n| +--+--+\n| | |--|\n+-------+--+--+\n```",
"type": "string",
"const": "BSP"
},
{
"description": "Columns Layout\n\n```\n+--+--+--+--+\n| | | | |\n| | | | |\n| | | | |\n+--+--+--+--+\n```",
"description": "Columns Layout\n\n```text\n+--+--+--+--+\n| | | | |\n| | | | |\n| | | | |\n+--+--+--+--+\n```",
"type": "string",
"const": "Columns"
},
{
"description": "Rows Layout\n\n```\n+-----------+\n|-----------|\n|-----------|\n|-----------|\n+-----------+\n```",
"description": "Rows Layout\n\n```text\n+-----------+\n|-----------|\n|-----------|\n|-----------|\n+-----------+\n```",
"type": "string",
"const": "Rows"
},
{
"description": "Vertical Stack Layout\n\n```\n+-------+-----+\n| | |\n| +-----+\n| | |\n+-------+-----+\n```",
"description": "Vertical Stack Layout\n\n```text\n+-------+-----+\n| | |\n| +-----+\n| | |\n+-------+-----+\n```",
"type": "string",
"const": "VerticalStack"
},
{
"description": "Horizontal Stack Layout\n\n```\n+------+------+\n| |\n|------+------+\n| | |\n+------+------+\n```",
"description": "Horizontal Stack Layout\n\n```text\n+------+------+\n| |\n|------+------+\n| | |\n+------+------+\n```",
"type": "string",
"const": "HorizontalStack"
},
{
"description": "Ultrawide Vertical Stack Layout\n\n```\n+-----+-----------+-----+\n| | | |\n| | +-----+\n| | | |\n| | +-----+\n| | | |\n+-----+-----------+-----+\n```",
"description": "Ultrawide Vertical Stack Layout\n\n```text\n+-----+-----------+-----+\n| | | |\n| | +-----+\n| | | |\n| | +-----+\n| | | |\n+-----+-----------+-----+\n```",
"type": "string",
"const": "UltrawideVerticalStack"
},
{
"description": "Grid Layout\n\n```\n+-----+-----+ +---+---+---+ +---+---+---+ +---+---+---+\n| | | | | | | | | | | | | | |\n| | | | | | | | | | | | | +---+\n+-----+-----+ | +---+---+ +---+---+---+ +---+---| |\n| | | | | | | | | | | | | +---+\n| | | | | | | | | | | | | | |\n+-----+-----+ +---+---+---+ +---+---+---+ +---+---+---+\n 4 windows 5 windows 6 windows 7 windows\n```",
"description": "Grid Layout\n\n```text\n+-----+-----+ +---+---+---+ +---+---+---+ +---+---+---+\n| | | | | | | | | | | | | | |\n| | | | | | | | | | | | | +---+\n+-----+-----+ | +---+---+ +---+---+---+ +---+---| |\n| | | | | | | | | | | | | +---+\n| | | | | | | | | | | | | | |\n+-----+-----+ +---+---+---+ +---+---+---+ +---+---+---+\n 4 windows 5 windows 6 windows 7 windows\n```",
"type": "string",
"const": "Grid"
},
{
"description": "Right Main Vertical Stack Layout\n\n```\n+-----+-------+\n| | |\n+-----+ |\n| | |\n+-----+-------+\n```",
"description": "Right Main Vertical Stack Layout\n\n```text\n+-----+-------+\n| | |\n+-----+ |\n| | |\n+-----+-------+\n```",
"type": "string",
"const": "RightMainVerticalStack"
},
{
"description": "Scrolling Layout\n\n```\n+--+--+--+--+--+--+\n| | | |\n| | | |\n| | | |\n+--+--+--+--+--+--+\n```",
"description": "Scrolling Layout\n\n```text\n+--+--+--+--+--+--+\n| | | |\n| | | |\n| | | |\n+--+--+--+--+--+--+\n```",
"type": "string",
"const": "Scrolling"
}
@@ -2902,6 +2901,23 @@
"description": "Options for specific layouts",
"type": "object",
"properties": {
"column_ratios": {
"description": "Column width ratios (up to MAX_RATIOS values between 0.1 and 0.9)\n\n- Used by Columns layout: ratios for each column width\n- Used by Grid layout: ratios for column widths\n- Used by BSP, VerticalStack, RightMainVerticalStack: column_ratios[0] as primary split ratio\n- Used by HorizontalStack: column_ratios[0] as primary split ratio (top area height)\n- Used by UltrawideVerticalStack: column_ratios[0] as center ratio, column_ratios[1] as left ratio\n\nColumns without a ratio share remaining space equally.\nExample: `[0.3, 0.4, 0.3]` for 30%-40%-30% columns",
"type": [
"array",
"null"
],
"default": null,
"items": {
"type": [
"number",
"null"
],
"format": "float"
},
"maxItems": 5,
"minItems": 5
},
"grid": {
"description": "Options related to the Grid layout",
"anyOf": [
@@ -2913,6 +2929,23 @@
}
]
},
"row_ratios": {
"description": "Row height ratios (up to MAX_RATIOS values between 0.1 and 0.9)\n\n- Used by Rows layout: ratios for each row height\n- Used by Grid layout: ratios for row heights\n\nRows without a ratio share remaining space equally.\nExample: `[0.5, 0.5]` for 50%-50% rows",
"type": [
"array",
"null"
],
"default": null,
"items": {
"type": [
"number",
"null"
],
"format": "float"
},
"maxItems": 5,
"minItems": 5
},
"scrolling": {
"description": "Options related to the Scrolling layout",
"anyOf": [