aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/kdl/mod.rs
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2026-07-31 19:19:49 +0200
committerGitHub <noreply@github.com>2026-07-31 19:19:49 +0200
commit0e6e4404027a187f1399a43bf91bdbd13d9636e1 (patch)
treeb334f14704939620e846caa30ab925fefca34d70 /zellij-utils/src/kdl/mod.rs
parentfix(build): remove manpage, honor CARGO_TARGET_DIR, add cargo argument passth... (diff)
downloadsl0ppij-0e6e4404027a187f1399a43bf91bdbd13d9636e1.tar.gz
sl0ppij-0e6e4404027a187f1399a43bf91bdbd13d9636e1.tar.xz
sl0ppij-0e6e4404027a187f1399a43bf91bdbd13d9636e1.zip
Support the Kitty Image Protocol (#5428)
* initial implementation - kinda working * tests and fixes * fix bounds * tests and compatibility fixes * fix: cursor scroll, clears, deletes, key tolerance, and host id range * fix: keep images alive across resize, relayout and history scroll * anchor to lines, not pixels * fix image/text alignments * config to allow disabling * fix pinned pane issue * never let host graphics replies reach the keyboard parser * fix nested session * properly handle fullscreening a pane * rustfmt * cleanup of ignored test * add pr
Diffstat (limited to 'zellij-utils/src/kdl/mod.rs')
-rw-r--r--zellij-utils/src/kdl/mod.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/zellij-utils/src/kdl/mod.rs b/zellij-utils/src/kdl/mod.rs
index 4e7b3735..8e86445f 100644
--- a/zellij-utils/src/kdl/mod.rs
+++ b/zellij-utils/src/kdl/mod.rs
@@ -2833,6 +2833,11 @@ impl Options {
"support_kitty_keyboard_protocol"
)
.map(|(v, _)| v);
+ let support_kitty_graphics_protocol = kdl_property_first_arg_as_bool_or_error!(
+ kdl_options,
+ "support_kitty_graphics_protocol"
+ )
+ .map(|(v, _)| v);
let web_server =
kdl_property_first_arg_as_bool_or_error!(kdl_options, "web_server").map(|(v, _)| v);
let web_sharing =
@@ -2992,6 +2997,7 @@ impl Options {
serialization_interval,
disable_session_metadata,
support_kitty_keyboard_protocol,
+ support_kitty_graphics_protocol,
web_server,
web_sharing,
stacked_resize,
@@ -3938,6 +3944,34 @@ impl Options {
None
}
}
+ fn support_kitty_graphics_protocol_to_kdl(&self, add_comments: bool) -> Option<KdlNode> {
+ let comment_text = format!("{}\n{}\n{}\n{}\n{}",
+ " ",
+ "// Enable or disable support for the Kitty Graphics Protocol, used to display images (the host terminal must also support it)",
+ "// (Requires restart)",
+ "// Default: true (if the host terminal supports it)",
+ "// ",
+ );
+
+ let create_node = |node_value: bool| -> KdlNode {
+ let mut node = KdlNode::new("support_kitty_graphics_protocol");
+ node.push(KdlValue::Bool(node_value));
+ node
+ };
+ if let Some(support_kitty_graphics_protocol) = self.support_kitty_graphics_protocol {
+ let mut node = create_node(support_kitty_graphics_protocol);
+ 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_to_kdl(&self, add_comments: bool) -> Option<KdlNode> {
let comment_text = format!(
"{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}",
@@ -4702,6 +4736,11 @@ impl Options {
{
nodes.push(support_kitty_keyboard_protocol);
}
+ if let Some(support_kitty_graphics_protocol) =
+ self.support_kitty_graphics_protocol_to_kdl(add_comments)
+ {
+ nodes.push(support_kitty_graphics_protocol);
+ }
if let Some(web_server) = self.web_server_to_kdl(add_comments) {
nodes.push(web_server);
}