aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/kdl
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2026-03-11 20:31:06 +0100
committerGitHub <noreply@github.com>2026-03-11 20:31:06 +0100
commit6e521c74d3c0fa3449cd0c1f1971ee807e88d98e (patch)
tree1409d05ac42b28453dd922a167345d69ddb3b924 /zellij-utils/src/kdl
parentadd verify cli test (#4835) (diff)
downloadsl0ppij-6e521c74d3c0fa3449cd0c1f1971ee807e88d98e.tar.gz
sl0ppij-6e521c74d3c0fa3449cd0c1f1971ee807e88d98e.tar.xz
sl0ppij-6e521c74d3c0fa3449cd0c1f1971ee807e88d98e.zip
Focus follows mouse and mouse clickthrough (#4836)
* implement focus follows mouse * mouse click through * rustfmt * add pr
Diffstat (limited to 'zellij-utils/src/kdl')
-rw-r--r--zellij-utils/src/kdl/mod.rs66
-rw-r--r--zellij-utils/src/kdl/snapshots/zellij_utils__kdl__bare_config_from_default_assets_to_string_with_comments.snap8
-rw-r--r--zellij-utils/src/kdl/snapshots/zellij_utils__kdl__config_options_to_string_with_comments.snap8
3 files changed, 82 insertions, 0 deletions
diff --git a/zellij-utils/src/kdl/mod.rs b/zellij-utils/src/kdl/mod.rs
index 7408c3a4..28727d17 100644
--- a/zellij-utils/src/kdl/mod.rs
+++ b/zellij-utils/src/kdl/mod.rs
@@ -2789,6 +2789,12 @@ impl Options {
};
let visual_bell =
kdl_property_first_arg_as_bool_or_error!(kdl_options, "visual_bell").map(|(v, _)| v);
+ let focus_follows_mouse =
+ kdl_property_first_arg_as_bool_or_error!(kdl_options, "focus_follows_mouse")
+ .map(|(v, _)| v);
+ let mouse_click_through =
+ kdl_property_first_arg_as_bool_or_error!(kdl_options, "mouse_click_through")
+ .map(|(v, _)| v);
Ok(Options {
simplified_ui,
@@ -2827,6 +2833,8 @@ impl Options {
advanced_mouse_actions,
mouse_hover_effects,
visual_bell,
+ focus_follows_mouse,
+ mouse_click_through,
web_server_ip,
web_server_port,
web_server_cert,
@@ -3985,6 +3993,58 @@ impl Options {
None
}
}
+ fn focus_follows_mouse_to_kdl(&self, add_comments: bool) -> Option<KdlNode> {
+ let comment_text = format!(
+ "{}\n{}\n{}",
+ " ", "// Whether to focus panes on mouse hover", "// default is false",
+ );
+
+ let create_node = |node_value: bool| -> KdlNode {
+ let mut node = KdlNode::new("focus_follows_mouse");
+ node.push(KdlValue::Bool(node_value));
+ node
+ };
+ if let Some(focus_follows_mouse) = self.focus_follows_mouse {
+ let mut node = create_node(focus_follows_mouse);
+ if add_comments {
+ node.set_leading(format!("{}\n", comment_text));
+ }
+ Some(node)
+ } else if add_comments {
+ let mut node = create_node(false);
+ node.set_leading(format!("{}\n// ", comment_text));
+ Some(node)
+ } else {
+ None
+ }
+ }
+ fn mouse_click_through_to_kdl(&self, add_comments: bool) -> Option<KdlNode> {
+ let comment_text = format!(
+ "{}\n{}\n{}",
+ " ",
+ "// Whether clicking a pane to focus it also sends the click into the pane",
+ "// default is false",
+ );
+
+ let create_node = |node_value: bool| -> KdlNode {
+ let mut node = KdlNode::new("mouse_click_through");
+ node.push(KdlValue::Bool(node_value));
+ node
+ };
+ if let Some(mouse_click_through) = self.mouse_click_through {
+ let mut node = create_node(mouse_click_through);
+ if add_comments {
+ node.set_leading(format!("{}\n", comment_text));
+ }
+ Some(node)
+ } else if add_comments {
+ let mut node = create_node(false);
+ 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{}",
@@ -4222,6 +4282,12 @@ impl Options {
if let Some(visual_bell) = self.visual_bell_to_kdl(add_comments) {
nodes.push(visual_bell);
}
+ if let Some(focus_follows_mouse) = self.focus_follows_mouse_to_kdl(add_comments) {
+ nodes.push(focus_follows_mouse);
+ }
+ if let Some(mouse_click_through) = self.mouse_click_through_to_kdl(add_comments) {
+ nodes.push(mouse_click_through);
+ }
if let Some(web_server_ip) = self.web_server_ip_to_kdl(add_comments) {
nodes.push(web_server_ip);
}
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 3dbaf47d..6dad8aea 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
@@ -541,6 +541,14 @@ web_client {
// default is true
// visual_bell true
+// Whether to focus panes on mouse hover
+// default is false
+// focus_follows_mouse false
+
+// Whether clicking a pane to focus it also sends the click into the pane
+// default is false
+// mouse_click_through false
+
// 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 e6a0ddda..e1f47782 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
@@ -260,6 +260,14 @@ web_sharing "disabled"
// default is true
// visual_bell true
+// Whether to focus panes on mouse hover
+// default is false
+// focus_follows_mouse false
+
+// Whether clicking a pane to focus it also sends the click into the pane
+// default is false
+// mouse_click_through false
+
// The ip address the web server should listen on when it starts
// Default: "127.0.0.1"
// (Requires restart)