mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-12-02 05:04:19 +01:00
feat(scrolling): lay out the Scrolling layout with the scrolling model
The workspace keeps a ScrollingSpace of komorebi-scrolling, keyed by the id of each container, in place of recomputing equal columns from the last layout. A column can hold several windows. New commands and messages: consume, expel, toggle-column-stack, scrolling-layout-full-width, center-focus, expand and pan. Focus, move, resize, retile and closing a window go through the strip, and a drag of an edge keeps it with the rest of what the drag started from. A window that is out of view rests at the edge it left by, with 5 pixels of it on the screen and its size unchanged, and is hidden where another monitor is next to that edge. A window that will not get as narrow as its column widens the column, at the first layout after the windows have had 400 ms to draw. center_focused_column is Never, Always or OnOverflow, and still reads a boolean.
This commit is contained in:
1 parent
3f51b3a0ca
commit
db976212b1
14 files changed
+2053
-82
No files matched your search
@@ -14,6 +14,10 @@
|
||||
//! workspace, `scrolling-layout-columns` and `layout-ratios` tune it, `toggle-tiling` turns its
|
||||
//! tiling off and on, and `preselect-direction` and `cancel-preselect` reserve the place of the
|
||||
//! next window and give it up.
|
||||
//! - `consume`, `expel` and `toggle-column-stack` put windows in the same column of the Scrolling
|
||||
//! layout and take them out, `scrolling-layout-full-width`, `center-focus` and `expand` make the
|
||||
//! focused column as wide as the screen, put it in the middle and fill the room that is left,
|
||||
//! and `pan` moves the view along the strip without moving the focus.
|
||||
//! - `stack` puts the focused window in one container with the window on one side of it, so that
|
||||
//! they share a tile and only one is in sight, `unstack` takes it out again, and `stack-all` and
|
||||
//! `unstack-all` do it for the whole workspace and for the focused stack. `cycle-stack` brings
|
||||
@@ -130,6 +134,7 @@ use komorebi_client::FocusFollowsMouseImplementation;
|
||||
use komorebi_client::MoveBehaviour;
|
||||
use komorebi_client::OperationBehaviour;
|
||||
use komorebi_client::OperationDirection;
|
||||
use komorebi_client::PanDirection;
|
||||
use komorebi_client::PathExt;
|
||||
use komorebi_client::Rect;
|
||||
use komorebi_client::Sizing;
|
||||
@@ -207,6 +212,7 @@ macro_rules! gen_enum_subcommand_args {
|
||||
gen_enum_subcommand_args! {
|
||||
Focus: OperationDirection,
|
||||
Move: OperationDirection,
|
||||
Consume: OperationDirection,
|
||||
PreselectDirection: OperationDirection,
|
||||
CycleFocus: CycleDirection,
|
||||
CycleMove: CycleDirection,
|
||||
@@ -732,6 +738,13 @@ struct ScrollingLayoutColumns {
|
||||
count: NonZeroUsize,
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
struct Pan {
|
||||
/// The way that the view goes
|
||||
#[clap(value_enum)]
|
||||
direction: PanDirection,
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
struct LayoutRatios {
|
||||
/// Column width ratios (space-separated values between 0.1 and 0.9)
|
||||
@@ -1097,6 +1110,27 @@ 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,
|
||||
/// Move the view of the Scrolling layout a column to the left or the right, which does
|
||||
/// nothing in any other layout
|
||||
#[clap(arg_required_else_help = true)]
|
||||
Pan(Pan),
|
||||
/// Set the layout column and row ratios for the focused workspace
|
||||
LayoutRatios(LayoutRatios),
|
||||
// /// Load a custom layout from file for the focused workspace
|
||||
@@ -2049,6 +2083,27 @@ fn main() -> eyre::Result<()> {
|
||||
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::Pan(args) => {
|
||||
send_message(&SocketMessage::Pan(args.direction))?;
|
||||
}
|
||||
SubCommand::LayoutRatios(args) => {
|
||||
if args.columns.is_none() && args.rows.is_none() {
|
||||
println!(
|
||||
|
||||
Reference in new issue
Block a user