aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoruser <user@clank>2026-08-08 20:16:54 +0200
committeruser <user@clank>2026-08-08 20:16:54 +0200
commit3dfd1e2f7565f5f8218becbbb9ed44531b5c0373 (patch)
treef90fb0784ae36d4db5201dd2c778ea8fdec2e14b
parentsl0p: fix status bar vanishing when pane gap is set (diff)
downloadsl0ppij-3dfd1e2f7565f5f8218becbbb9ed44531b5c0373.tar.gz
sl0ppij-3dfd1e2f7565f5f8218becbbb9ed44531b5c0373.tar.xz
sl0ppij-3dfd1e2f7565f5f8218becbbb9ed44531b5c0373.zip
sl0p: hot-reload title alignment, gap and padding on config change
The three sl0p frame options were read once at session start: zellij's ScreenInstruction::Reconfigure carries an explicit, hand-maintained field list (pane_frame_style, rounded_corners, hide_session_name, ...) and ours were not in it, so editing config.kdl did nothing until a new session. Wires them through the existing reconfigure path: lib.rs -> ScreenInstruction::Reconfigure -> Screen::reconfigure -> Tab::update_frame_layout -> {tiled,floating}_panes fanout -> Pane::update_frame_layout Two ordering/coverage details that are easy to get wrong: - Tab::update_frame_layout must run BEFORE set_pane_frames. gap/padding are baked into content_offset when it is set, not read live at render time, so the values must be in place before the sweep that recomputes offsets. - FloatingPanes::set_pane_frame_style only re-runs that sweep when a floating pane is fullscreen, so ordinary floating panes would have kept their old inset until the next resize. The floating fanout now recomputes explicitly. Title alignment needs no recompute (it is read at render time) but rides the same path for consistency; panes clear their frame cache so it repaints.
-rw-r--r--zellij-server/src/lib.rs3
-rw-r--r--zellij-server/src/panes/floating_panes/mod.rs18
-rw-r--r--zellij-server/src/panes/plugin_pane.rs11
-rw-r--r--zellij-server/src/panes/terminal_pane.rs11
-rw-r--r--zellij-server/src/panes/tiled_panes/mod.rs13
-rw-r--r--zellij-server/src/screen.rs18
-rw-r--r--zellij-server/src/tab/mod.rs29
7 files changed, 102 insertions, 1 deletions
diff --git a/zellij-server/src/lib.rs b/zellij-server/src/lib.rs
index 319a106c..21238eab 100644
--- a/zellij-server/src/lib.rs
+++ b/zellij-server/src/lib.rs
@@ -459,6 +459,9 @@ impl SessionMetaData {
auto_layout: new_config.options.auto_layout.unwrap_or(true),
rounded_corners: new_config.ui.pane_frames.rounded_corners,
hide_session_name: new_config.ui.pane_frames.hide_session_name,
+ pane_title_alignment: new_config.ui.pane_frames.title_alignment,
+ pane_gap: new_config.ui.pane_frames.gap,
+ pane_padding: new_config.ui.pane_frames.padding,
stacked_resize: new_config.options.stacked_resize.unwrap_or(true),
stacked_pane_list: new_config.options.stacked_pane_list.unwrap_or(true),
default_editor: new_config.options.scrollback_editor.clone(),
diff --git a/zellij-server/src/panes/floating_panes/mod.rs b/zellij-server/src/panes/floating_panes/mod.rs
index ed93de5a..157a912f 100644
--- a/zellij-server/src/panes/floating_panes/mod.rs
+++ b/zellij-server/src/panes/floating_panes/mod.rs
@@ -1720,6 +1720,24 @@ impl FloatingPanes {
pane.update_rounded_corners(rounded_corners);
}
}
+ pub fn update_pane_frame_layout(
+ &mut self,
+ title_alignment: zellij_utils::data::PaneTitleAlignment,
+ gap: usize,
+ padding: usize,
+ ) {
+ self.style.pane_title_alignment = title_alignment;
+ self.style.pane_gap = gap;
+ self.style.pane_padding = padding;
+ for pane in self.panes.values_mut() {
+ pane.update_frame_layout(title_alignment, gap, padding);
+ }
+ // Unlike the tiled panes, `set_pane_frame_style` only re-runs the
+ // content-offset sweep for a fullscreen floating pane, so gap/padding
+ // changes would otherwise not apply to ordinary floating panes until
+ // the next resize. Recompute them here.
+ let _ = self.set_pane_frames();
+ }
pub fn next_selectable_pane_id_above(&mut self, pane_id: &PaneId) -> Option<PaneId> {
let display_area = *self.display_area.borrow();
let viewport = *self.viewport.borrow();
diff --git a/zellij-server/src/panes/plugin_pane.rs b/zellij-server/src/panes/plugin_pane.rs
index 534a149c..163da48d 100644
--- a/zellij-server/src/panes/plugin_pane.rs
+++ b/zellij-server/src/panes/plugin_pane.rs
@@ -853,6 +853,17 @@ impl Pane for PluginPane {
self.style.rounded_corners = rounded_corners;
self.frame.clear();
}
+ fn update_frame_layout(
+ &mut self,
+ title_alignment: zellij_utils::data::PaneTitleAlignment,
+ gap: usize,
+ padding: usize,
+ ) {
+ self.style.pane_title_alignment = title_alignment;
+ self.style.pane_gap = gap;
+ self.style.pane_padding = padding;
+ self.frame.clear();
+ }
fn set_should_be_suppressed(&mut self, should_be_suppressed: bool) {
self.should_be_suppressed = should_be_suppressed;
}
diff --git a/zellij-server/src/panes/terminal_pane.rs b/zellij-server/src/panes/terminal_pane.rs
index 709c3dfd..a1258edf 100644
--- a/zellij-server/src/panes/terminal_pane.rs
+++ b/zellij-server/src/panes/terminal_pane.rs
@@ -1209,6 +1209,17 @@ impl Pane for TerminalPane {
self.style.rounded_corners = rounded_corners;
self.frame.clear();
}
+ fn update_frame_layout(
+ &mut self,
+ title_alignment: zellij_utils::data::PaneTitleAlignment,
+ gap: usize,
+ padding: usize,
+ ) {
+ self.style.pane_title_alignment = title_alignment;
+ self.style.pane_gap = gap;
+ self.style.pane_padding = padding;
+ self.frame.clear();
+ }
fn drain_fake_cursors(&mut self) -> Option<HashSet<(usize, usize)>> {
if !self.fake_cursor_locations.is_empty() {
for (y, _x) in &self.fake_cursor_locations {
diff --git a/zellij-server/src/panes/tiled_panes/mod.rs b/zellij-server/src/panes/tiled_panes/mod.rs
index 43e9eb9e..1dbc7bb8 100644
--- a/zellij-server/src/panes/tiled_panes/mod.rs
+++ b/zellij-server/src/panes/tiled_panes/mod.rs
@@ -3118,6 +3118,19 @@ impl TiledPanes {
pane.update_rounded_corners(rounded_corners);
}
}
+ pub fn update_pane_frame_layout(
+ &mut self,
+ title_alignment: zellij_utils::data::PaneTitleAlignment,
+ gap: usize,
+ padding: usize,
+ ) {
+ self.style.pane_title_alignment = title_alignment;
+ self.style.pane_gap = gap;
+ self.style.pane_padding = padding;
+ for pane in self.panes.values_mut() {
+ pane.update_frame_layout(title_alignment, gap, padding);
+ }
+ }
pub fn stack_panes(
&mut self,
root_pane_id: PaneId,
diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs
index bec746ef..b17cc61f 100644
--- a/zellij-server/src/screen.rs
+++ b/zellij-server/src/screen.rs
@@ -43,7 +43,8 @@ use zellij_utils::data::{
CommandOrPlugin, Direction, EventType, FloatingPaneCoordinates, GetFocusedPaneInfoResponse,
HostTerminalThemeMode, KeyWithModifier, LayoutInfo, LayoutWithError, ListPanesResponse,
ListTabsResponse, NewPanePlacement, PaneContents, PaneInfo, PaneListEntry, PaneManifest,
- PaneRenderReport, PaneScrollbackResponse, PluginPermission, RegexHighlight, Resize,
+ PaneRenderReport, PaneScrollbackResponse, PaneTitleAlignment, PluginPermission,
+ RegexHighlight, Resize,
ResizeStrategy, SessionInfo, Styling, TabInfo, ThemeHue, WebSharing,
};
use zellij_utils::errors::prelude::*;
@@ -775,6 +776,9 @@ pub enum ScreenInstruction {
auto_layout: bool,
rounded_corners: bool,
hide_session_name: bool,
+ pane_title_alignment: PaneTitleAlignment,
+ pane_gap: usize,
+ pane_padding: usize,
stacked_resize: bool,
stacked_pane_list: bool,
default_editor: Option<PathBuf>,
@@ -6261,6 +6265,9 @@ impl Screen {
auto_layout: bool,
rounded_corners: bool,
hide_session_name: bool,
+ pane_title_alignment: PaneTitleAlignment,
+ pane_gap: usize,
+ pane_padding: usize,
stacked_resize: bool,
stacked_pane_list: bool,
default_editor: Option<PathBuf>,
@@ -6318,6 +6325,9 @@ impl Screen {
tab.update_default_editor(self.default_editor.clone());
tab.update_auto_layout(auto_layout);
tab.update_copy_options(&self.copy_options);
+ // must precede set_pane_frames: gap/padding are baked into
+ // content_offset by the sweep that set_pane_frames triggers
+ tab.update_frame_layout(pane_title_alignment, pane_gap, pane_padding);
tab.set_pane_frames(pane_frame_style);
tab.update_arrow_fonts(should_support_arrow_fonts);
tab.update_advanced_mouse_actions(advanced_mouse_actions);
@@ -10833,6 +10843,9 @@ pub(crate) fn screen_thread_main(
auto_layout,
rounded_corners,
hide_session_name,
+ pane_title_alignment,
+ pane_gap,
+ pane_padding,
stacked_resize,
stacked_pane_list,
default_editor,
@@ -10860,6 +10873,9 @@ pub(crate) fn screen_thread_main(
auto_layout,
rounded_corners,
hide_session_name,
+ pane_title_alignment,
+ pane_gap,
+ pane_padding,
stacked_resize,
stacked_pane_list,
default_editor,
diff --git a/zellij-server/src/tab/mod.rs b/zellij-server/src/tab/mod.rs
index 55ff8a58..beec913b 100644
--- a/zellij-server/src/tab/mod.rs
+++ b/zellij-server/src/tab/mod.rs
@@ -737,6 +737,18 @@ pub trait Pane {
fn update_arrow_fonts(&mut self, _should_support_arrow_fonts: bool) {}
fn update_kitty_host_support(&mut self, _supported: KittyHostSupport) {}
fn update_rounded_corners(&mut self, _rounded_corners: bool) {}
+ /// Live-update the sl0p frame layout options (title alignment, outer gap,
+ /// inner padding). Callers MUST follow this with the usual
+ /// `set_pane_frames` sweep: gap/padding are baked into `content_offset`
+ /// when it is set, so changing them here only takes effect once
+ /// `set_content_offset` is re-run.
+ fn update_frame_layout(
+ &mut self,
+ _title_alignment: zellij_utils::data::PaneTitleAlignment,
+ _gap: usize,
+ _padding: usize,
+ ) {
+ }
fn set_should_be_suppressed(&mut self, _should_be_suppressed: bool) {}
fn query_should_be_suppressed(&self) -> bool {
false
@@ -7397,6 +7409,23 @@ impl Tab {
pane.update_rounded_corners(rounded_corners);
}
}
+ pub fn update_frame_layout(
+ &mut self,
+ title_alignment: zellij_utils::data::PaneTitleAlignment,
+ gap: usize,
+ padding: usize,
+ ) {
+ self.style.pane_title_alignment = title_alignment;
+ self.style.pane_gap = gap;
+ self.style.pane_padding = padding;
+ self.floating_panes
+ .update_pane_frame_layout(title_alignment, gap, padding);
+ self.tiled_panes
+ .update_pane_frame_layout(title_alignment, gap, padding);
+ for (_, pane) in self.suppressed_panes.values_mut() {
+ pane.update_frame_layout(title_alignment, gap, padding);
+ }
+ }
pub fn update_arrow_fonts(&mut self, should_support_arrow_fonts: bool) {
self.arrow_fonts = should_support_arrow_fonts;
self.floating_panes