diff options
| author | Aram Drevekenin <aram@poor.dev> | 2026-03-03 08:20:04 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-03 08:20:04 +0100 |
| commit | f618b0653abc918f9c34b5a4e8a06e4a11745b43 (patch) | |
| tree | b2a1cea091bd395fda4843733a081d1c87180823 /zellij-utils/src/kdl | |
| parent | feat(web): improve web client ui on mobile (#4723) (diff) | |
| download | sl0ppij-f618b0653abc918f9c34b5a4e8a06e4a11745b43.tar.gz sl0ppij-f618b0653abc918f9c34b5a4e8a06e4a11745b43.tar.xz sl0ppij-f618b0653abc918f9c34b5a4e8a06e4a11745b43.zip | |
Visual indication for terminal bells (#4781)
* initial implementation
* rustfmt
* allow disabling with config
* add missing kdl
* add pr
* fix tests
Diffstat (limited to 'zellij-utils/src/kdl')
3 files changed, 47 insertions, 0 deletions
diff --git a/zellij-utils/src/kdl/mod.rs b/zellij-utils/src/kdl/mod.rs index ced75920..12eadff6 100644 --- a/zellij-utils/src/kdl/mod.rs +++ b/zellij-utils/src/kdl/mod.rs @@ -2781,6 +2781,8 @@ impl Options { }, None => None, }; + let visual_bell = + kdl_property_first_arg_as_bool_or_error!(kdl_options, "visual_bell").map(|(v, _)| v); Ok(Options { simplified_ui, @@ -2818,6 +2820,7 @@ impl Options { show_release_notes, advanced_mouse_actions, mouse_hover_effects, + visual_bell, web_server_ip, web_server_port, web_server_cert, @@ -3949,6 +3952,33 @@ impl Options { None } } + fn visual_bell_to_kdl(&self, add_comments: bool) -> Option<KdlNode> { + let comment_text = format!( + "{}\n{}\n{}", + " ", + "// Whether to show visual bell indicators (pane/tab frame flash and [!] suffix)", + "// default is true", + ); + + let create_node = |node_value: bool| -> KdlNode { + let mut node = KdlNode::new("visual_bell"); + node.push(KdlValue::Bool(node_value)); + node + }; + if let Some(visual_bell) = self.visual_bell { + let mut node = create_node(visual_bell); + if add_comments { + node.set_leading(format!("{}\n", comment_text)); + } + Some(node) + } else if add_comments { + let mut node = create_node(true); + node.set_leading(format!("{}\n// ", comment_text)); + Some(node) + } else { + None + } + } fn web_server_ip_to_kdl(&self, add_comments: bool) -> Option<KdlNode> { let comment_text = format!( "{}\n{}\n{}\n{}", @@ -4183,6 +4213,9 @@ impl Options { if let Some(mouse_hover_effects) = self.mouse_hover_effects_to_kdl(add_comments) { nodes.push(mouse_hover_effects); } + if let Some(visual_bell) = self.visual_bell_to_kdl(add_comments) { + nodes.push(visual_bell); + } if let Some(web_server_ip) = self.web_server_ip_to_kdl(add_comments) { nodes.push(web_server_ip); } @@ -5659,6 +5692,8 @@ impl TabInfo { selectable_tiled_panes_count, selectable_floating_panes_count, tab_id, + has_bell_notification: false, + is_flashing_bell: false, }) } pub fn encode_to_kdl(&self) -> KdlDocument { @@ -6090,6 +6125,8 @@ fn serialize_and_deserialize_session_info_with_data() { selectable_tiled_panes_count: 10, selectable_floating_panes_count: 10, tab_id: 0, + is_flashing_bell: false, + has_bell_notification: false, }, TabInfo { position: 1, @@ -6109,6 +6146,8 @@ fn serialize_and_deserialize_session_info_with_data() { selectable_tiled_panes_count: 10, selectable_floating_panes_count: 10, tab_id: 1, + is_flashing_bell: false, + has_bell_notification: false, }, ], panes: PaneManifest { panes }, diff --git a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__bare_config_from_default_assets_to_string_with_comments.snap b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__bare_config_from_default_assets_to_string_with_comments.snap index 26a1be67..da967bcb 100644 --- a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__bare_config_from_default_assets_to_string_with_comments.snap +++ b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__bare_config_from_default_assets_to_string_with_comments.snap @@ -536,6 +536,10 @@ web_client { // default is true // mouse_hover_effects false +// Whether to show visual bell indicators (pane/tab frame flash and [!] suffix) +// default is true +// visual_bell true + // The ip address the web server should listen on when it starts // Default: "127.0.0.1" // (Requires restart) diff --git a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__config_options_to_string_with_comments.snap b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__config_options_to_string_with_comments.snap index 18293ffb..e6a0ddda 100644 --- a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__config_options_to_string_with_comments.snap +++ b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__config_options_to_string_with_comments.snap @@ -256,6 +256,10 @@ web_sharing "disabled" // default is true // mouse_hover_effects false +// Whether to show visual bell indicators (pane/tab frame flash and [!] suffix) +// default is true +// visual_bell true + // The ip address the web server should listen on when it starts // Default: "127.0.0.1" // (Requires restart) |
