aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Jankowski <daniel.jankowski@rub.de>2025-01-18 10:00:01 +0100
committerDaniel Jankowski <daniel.jankowski@rub.de>2025-01-18 10:00:01 +0100
commit94e60999fd968505803ea6d3390caf98497a0eee (patch)
tree7b933cdbf5ece24aa20384e001d64680bf1907ae /src
parentfix(frames): show frames in search mode (diff)
downloadsl0pstatus-94e60999fd968505803ea6d3390caf98497a0eee.tar.gz
sl0pstatus-94e60999fd968505803ea6d3390caf98497a0eee.tar.xz
sl0pstatus-94e60999fd968505803ea6d3390caf98497a0eee.zip
feat(frames): hide frame except for scroll
fixes #116
Diffstat (limited to 'src')
-rw-r--r--src/bin/zjframes.rs9
-rw-r--r--src/bin/zjstatus.rs2
-rw-r--r--src/config.rs6
-rw-r--r--src/frames.rs21
4 files changed, 36 insertions, 2 deletions
diff --git a/src/bin/zjframes.rs b/src/bin/zjframes.rs
index b8edbb8..51e403a 100644
--- a/src/bin/zjframes.rs
+++ b/src/bin/zjframes.rs
@@ -20,6 +20,7 @@ struct State {
hide_frame_for_single_pane: bool,
hide_frame_except_for_search: bool,
hide_frame_except_for_fullscreen: bool,
+ hide_frame_except_for_scroll: bool,
err: Option<anyhow::Error>,
}
@@ -79,6 +80,11 @@ impl ZellijPlugin for State {
Some(toggle) => toggle == "true",
None => false,
};
+ self.hide_frame_except_for_scroll=
+ match configuration.get("hide_frame_except_for_scroll") {
+ Some(toggle) => toggle == "true",
+ None => false,
+ };
self.pending_events = Vec::new();
self.got_permissions = false;
@@ -140,6 +146,7 @@ impl State {
self.hide_frame_for_single_pane,
self.hide_frame_except_for_search,
self.hide_frame_except_for_fullscreen,
+ self.hide_frame_except_for_scroll,
),
&self.state.tabs,
&self.state.panes,
@@ -159,6 +166,7 @@ impl State {
self.hide_frame_for_single_pane,
self.hide_frame_except_for_search,
self.hide_frame_except_for_fullscreen,
+ self.hide_frame_except_for_scroll,
),
&self.state.tabs,
&self.state.panes,
@@ -184,6 +192,7 @@ impl State {
self.hide_frame_for_single_pane,
self.hide_frame_except_for_search,
self.hide_frame_except_for_fullscreen,
+ self.hide_frame_except_for_scroll,
),
&current_session.tabs,
&current_session.panes,
diff --git a/src/bin/zjstatus.rs b/src/bin/zjstatus.rs
index c4d5267..3f58683 100644
--- a/src/bin/zjstatus.rs
+++ b/src/bin/zjstatus.rs
@@ -207,6 +207,7 @@ impl State {
self.module_config.hide_frame_for_single_pane,
self.module_config.hide_frame_except_for_search,
self.module_config.hide_frame_except_for_fullscreen,
+ self.module_config.hide_frame_except_for_scroll,
),
&self.state.tabs,
&pane_info,
@@ -269,6 +270,7 @@ impl State {
self.module_config.hide_frame_for_single_pane,
self.module_config.hide_frame_except_for_search,
self.module_config.hide_frame_except_for_fullscreen,
+ self.module_config.hide_frame_except_for_scroll,
),
&current_session.tabs,
&current_session.panes,
diff --git a/src/config.rs b/src/config.rs
index 0bb260d..5a64b3d 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -81,6 +81,7 @@ pub struct ModuleConfig {
pub hide_frame_for_single_pane: bool,
pub hide_frame_except_for_search: bool,
pub hide_frame_except_for_fullscreen: bool,
+ pub hide_frame_except_for_scroll: bool,
pub border: BorderConfig,
pub format_precedence: Vec<Part>,
pub hide_on_overlength: bool,
@@ -105,6 +106,10 @@ impl ModuleConfig {
Some(toggle) => toggle == "true",
None => false,
};
+ let hide_frame_except_for_scroll = match config.get("hide_frame_except_for_scroll") {
+ Some(toggle) => toggle == "true",
+ None => false,
+ };
let left_parts_config = match config.get("format_left") {
Some(conf) => conf,
@@ -156,6 +161,7 @@ impl ModuleConfig {
hide_frame_for_single_pane,
hide_frame_except_for_search,
hide_frame_except_for_fullscreen,
+ hide_frame_except_for_scroll,
border: border_config,
format_precedence,
hide_on_overlength,
diff --git a/src/frames.rs b/src/frames.rs
index 268636e..60f4128 100644
--- a/src/frames.rs
+++ b/src/frames.rs
@@ -4,6 +4,7 @@ pub struct FrameConfig {
pub hide_frames_for_single_pane: bool,
pub hide_frames_except_for_search: bool,
pub hide_frames_except_for_fullscreen: bool,
+ pub hide_frames_except_for_scroll: bool,
}
impl FrameConfig {
@@ -11,11 +12,13 @@ impl FrameConfig {
hide_frames_for_single_pane: bool,
hide_frames_except_for_search: bool,
hide_frames_except_for_fullscreen: bool,
+ hide_frames_except_for_scroll: bool,
) -> Self {
Self {
hide_frames_for_single_pane,
hide_frames_except_for_search,
hide_frames_except_for_fullscreen,
+ hide_frames_except_for_scroll,
}
}
@@ -23,6 +26,7 @@ impl FrameConfig {
!self.hide_frames_for_single_pane
&& !self.hide_frames_except_for_search
&& !self.hide_frames_except_for_fullscreen
+ && !self.hide_frames_except_for_scroll
}
}
@@ -67,16 +71,29 @@ pub fn hide_frames_conditionally(
config.hide_frames_except_for_fullscreen && should_show_frames_for_fullscreen(&panes);
let frames_for_single_pane = config.hide_frames_for_single_pane
&& should_show_frames_for_multiple_panes(mode_info, &panes);
+ let frames_for_scroll =
+ config.hide_frames_except_for_scroll && should_show_frames_for_scroll(mode_info);
- if (frames_for_search || frames_for_fullscreen || frames_for_single_pane) && !frame_enabled {
+ if (frames_for_search || frames_for_fullscreen || frames_for_single_pane || frames_for_scroll)
+ && !frame_enabled
+ {
toggle_pane_frames();
}
- if (!frames_for_search && !frames_for_fullscreen && !frames_for_single_pane) && frame_enabled {
+ if (!frames_for_search
+ && !frames_for_fullscreen
+ && !frames_for_single_pane
+ && !frames_for_scroll)
+ && frame_enabled
+ {
toggle_pane_frames();
}
}
+pub fn should_show_frames_for_scroll(mode_info: &ModeInfo) -> bool {
+ mode_info.mode == InputMode::Scroll
+}
+
pub fn should_show_frames_for_search(mode_info: &ModeInfo) -> bool {
mode_info.mode == InputMode::EnterSearch || mode_info.mode == InputMode::Search
}