feat(scrolling): add commands and config for the scrolling layout

Focus, move, resize, retile and closing a window now go through the strip of
columns in the Scrolling layout. New commands: consume, expel,
toggle-column-stack, scrolling-layout-full-width and center-focus. A top
level scrolling section configures centering, centring a lone column, and
the minimum height of a window in a column of several.
This commit is contained in:
LGUG2Z committed 2026-10-28 19:15:47 -07:00
1 parent fa258fbbb2
commit c0ed13262f
5 files changed
+8925 -8869

No files matched your search

+7
View File
@@ -41,6 +41,7 @@ pub use komorebi_layouts::OperationDirection;
pub use komorebi_layouts::Rect;
pub use komorebi_layouts::ScrollingLayoutOptions;
pub use komorebi_layouts::Sizing;
pub use komorebi_layouts::scrolling::ScrollingCentering;
pub use komorebi_layouts::validate_ratios;
// Local modules and exports
@@ -125,6 +126,12 @@ pub enum SocketMessage {
CycleLayout(CycleDirection),
LayoutRatios(Option<Vec<f32>>, Option<Vec<f32>>),
ScrollingLayoutColumns(NonZeroUsize),
ScrollingLayoutFullWidth,
CenterFocus,
Expand,
Consume(OperationDirection),
Expel,
ToggleColumnStack,
ChangeLayoutCustom(#[serde_as(as = "ResolvedPathBuf")] PathBuf),
FlipLayout(Axis),
ToggleWorkspaceWindowContainerBehaviour,
+27 -23
View File
@@ -64,7 +64,6 @@ use crate::core::MonocleFocusBehaviour;
use crate::core::MoveBehaviour;
use crate::core::OperationDirection;
use crate::core::Rect;
use crate::core::ScrollingLayoutOptions;
use crate::core::Sizing;
use crate::core::SocketMessage;
use crate::core::StateQuery;
@@ -930,28 +929,33 @@ impl WindowManager {
}
SocketMessage::FlipLayout(layout_flip) => self.flip_layout(layout_flip)?,
SocketMessage::ScrollingLayoutColumns(count) => {
let focused_workspace = self.focused_workspace_mut()?;
let options = match focused_workspace.layout_options {
Some(mut opts) => {
if let Some(scrolling) = &mut opts.scrolling {
scrolling.columns = count.into();
}
opts
}
None => LayoutOptions {
scrolling: Some(ScrollingLayoutOptions {
columns: count.into(),
center_focused_column: Default::default(),
}),
grid: None,
column_ratios: None,
row_ratios: None,
},
};
focused_workspace.layout_options = Some(options);
self.focused_workspace_mut()?
.set_scrolling_columns(count.into());
self.update_focused_workspace(false, false)?;
}
SocketMessage::ScrollingLayoutFullWidth => {
self.focused_workspace_mut()?.toggle_scrolling_full_width();
self.update_focused_workspace(false, false)?;
}
SocketMessage::CenterFocus => {
self.focused_workspace_mut()?.center_scrolling_column();
self.update_focused_workspace(false, false)?;
}
SocketMessage::Expand => {
self.focused_workspace_mut()?.expand_scrolling_column();
self.update_focused_workspace(false, false)?;
}
SocketMessage::Consume(direction) => {
self.focused_workspace_mut()?.consume_scrolling(direction);
self.update_focused_workspace(false, false)?;
}
SocketMessage::ToggleColumnStack => {
self.focused_workspace_mut()?
.toggle_scrolling_column_stack()?;
self.update_focused_workspace(false, false)?;
}
SocketMessage::Expel => {
self.focused_workspace_mut()?.expel_scrolling();
self.update_focused_workspace(false, false)?;
}
SocketMessage::ChangeLayout(layout) => self.change_workspace_layout_default(layout)?,
File diff suppressed because it is too large. Load diff
+2814 -2824
View File
File diff suppressed because it is too large. Load diff
+36
View File
@@ -151,6 +151,7 @@ macro_rules! gen_enum_subcommand_args {
gen_enum_subcommand_args! {
Focus: OperationDirection,
Move: OperationDirection,
Consume: OperationDirection,
PreselectDirection: OperationDirection,
CycleFocus: CycleDirection,
CycleMove: CycleDirection,
@@ -1284,6 +1285,23 @@ enum SubCommand {
/// Set the number of visible columns for the Scrolling layout on the focused workspace
#[clap(arg_required_else_help = true)]
ScrollingLayoutColumns(ScrollingLayoutColumns),
/// Make the focused column of the Scrolling layout as wide as the screen, or put it back to
/// the width that it had
ScrollingLayoutFullWidth,
/// Scroll the Scrolling layout so that the focused column is in the middle of the screen, once
CenterFocus,
/// Make the focused column of the Scrolling layout fill the room that the columns in view leave
/// on the screen, which does nothing in any other layout
Expand,
/// Take the neighbouring window on one side into the focused column of the Scrolling layout
#[clap(arg_required_else_help = true)]
Consume(Consume),
/// Take the focused window out of its column in the Scrolling layout and put it in a column
/// of its own on the right
Expel,
/// Stack the windows of the focused column of the Scrolling layout, or spread the focused
/// stack out into a column with a window in each slot
ToggleColumnStack,
/// Set the layout column and row ratios for the focused workspace
LayoutRatios(LayoutRatios),
/// Load a custom layout from file for the focused workspace
@@ -2956,6 +2974,24 @@ if (Get-Command Get-CimInstance -ErrorAction SilentlyContinue) {
SubCommand::ScrollingLayoutColumns(args) => {
send_message(&SocketMessage::ScrollingLayoutColumns(args.count))?;
}
SubCommand::ScrollingLayoutFullWidth => {
send_message(&SocketMessage::ScrollingLayoutFullWidth)?;
}
SubCommand::CenterFocus => {
send_message(&SocketMessage::CenterFocus)?;
}
SubCommand::Expand => {
send_message(&SocketMessage::Expand)?;
}
SubCommand::Consume(args) => {
send_message(&SocketMessage::Consume(args.operation_direction))?;
}
SubCommand::Expel => {
send_message(&SocketMessage::Expel)?;
}
SubCommand::ToggleColumnStack => {
send_message(&SocketMessage::ToggleColumnStack)?;
}
SubCommand::LayoutRatios(args) => {
if args.columns.is_none() && args.rows.is_none() {
println!(