aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/kdl/mod.rs
diff options
context:
space:
mode:
authoruser <user@clank>2026-08-11 00:12:10 +0200
committeruser <user@clank>2026-08-11 00:12:10 +0200
commit393748bb2fb0ad741f2d51cfe0f8db75cf2ad7c3 (patch)
tree09a651d4640e18398df90cdac0857e8602bcd5a0 /zellij-utils/src/kdl/mod.rs
parentsl0p: refresh snapshots for the compact scroll indicator (diff)
downloadsl0ppij-393748bb2fb0ad741f2d51cfe0f8db75cf2ad7c3.tar.gz
sl0ppij-393748bb2fb0ad741f2d51cfe0f8db75cf2ad7c3.tar.xz
sl0ppij-393748bb2fb0ad741f2d51cfe0f8db75cf2ad7c3.zip
sl0p: collapse to a swap layout when the terminal gets narrow
Splitting a window into thirds is great until the window is 70 columns wide and each pane gets 23. `responsive_min_cols` collapses the tab into the swap layout named by `responsive_layout` when it gets narrower than that, and restores the previously active layout when it grows back. Selects a swap layout BY NAME rather than adding a size-aware LayoutConstraint: that type crosses both the plugin protobuf API and the client/server contract, and the committed prost assets cannot be regenerated here (no protoc). Restoring uses a 10-column hysteresis band. Without a dead band, dragging a window edge that lands exactly on the threshold flips the layout on every motion event, and every flip resizes every PTY in the tab. "Did the user rearrange panes by hand" is judged from the damaged flag as sampled BEFORE each resize, not the live one: resize_whole_tab's own auto-layout pass sets that flag itself and clears it again only if it found a layout that fits, so on a terminal too narrow for any of them it latches true although nothing was rearranged. And once collapsed, restore stays reachable regardless of the flag, so damage occurring while collapsed cannot strand the tab in the narrow layout.
Diffstat (limited to 'zellij-utils/src/kdl/mod.rs')
-rw-r--r--zellij-utils/src/kdl/mod.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/zellij-utils/src/kdl/mod.rs b/zellij-utils/src/kdl/mod.rs
index 8d7f4d9d..d7ea2de7 100644
--- a/zellij-utils/src/kdl/mod.rs
+++ b/zellij-utils/src/kdl/mod.rs
@@ -5602,6 +5602,14 @@ impl UiConfig {
let hide_default_pane_names =
kdl_children_property_first_arg_as_bool!(pane_frames, "hide_default_pane_names")
.unwrap_or(false);
+ let responsive_min_cols =
+ kdl_children_property_first_arg_as_i64!(pane_frames, "responsive_min_cols")
+ .unwrap_or(0)
+ .max(0) as usize;
+ let responsive_layout =
+ kdl_children_property_first_arg_as_string!(pane_frames, "responsive_layout")
+ .unwrap_or("stacked")
+ .to_string();
let frame_config = FrameConfig {
rounded_corners,
hide_session_name,
@@ -5611,6 +5619,8 @@ impl UiConfig {
gap_aspect,
inactive_grayscale,
hide_default_pane_names,
+ responsive_min_cols,
+ responsive_layout,
};
ui_config.pane_frames = frame_config;
}