aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-client
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2026-03-28 09:19:54 +0100
committerGitHub <noreply@github.com>2026-03-28 09:19:54 +0100
commit608cc9905d0e53cda32f22b184578915b7f0f7b4 (patch)
tree64e60645b412e3c9cecf83e8889ee1c6f0024593 /zellij-client
parentCLI focus-pane-id and are-floating-panes-visible actions (#4926) (diff)
downloadsl0ppij-608cc9905d0e53cda32f22b184578915b7f0f7b4.tar.gz
sl0ppij-608cc9905d0e53cda32f22b184578915b7f0f7b4.tar.xz
sl0ppij-608cc9905d0e53cda32f22b184578915b7f0f7b4.zip
Support OSC-99 desktop notifications (#4931)
* initial implementation * tests * fix: always report to zellij, only report to app if it wants a report * rustfmt * fix: always report capabilities to panes requesting them * rustfmt * add pr
Diffstat (limited to 'zellij-client')
-rw-r--r--zellij-client/src/input_handler.rs6
-rw-r--r--zellij-client/src/lib.rs1
-rw-r--r--zellij-client/src/stdin_handler.rs53
3 files changed, 48 insertions, 12 deletions
diff --git a/zellij-client/src/input_handler.rs b/zellij-client/src/input_handler.rs
index c61907a6..8b404f7b 100644
--- a/zellij-client/src/input_handler.rs
+++ b/zellij-client/src/input_handler.rs
@@ -247,6 +247,12 @@ impl InputHandler {
self.handle_stdin_ansi_instruction(ansi_instruction);
}
},
+ Ok((InputInstruction::DesktopNotificationResponse(raw_bytes), _error_context)) => {
+ self.os_input
+ .send_to_server(ClientToServerMsg::DesktopNotificationResponse {
+ raw_bytes,
+ });
+ },
Ok((InputInstruction::StartedParsing, _error_context)) => {
self.send_client_instructions
.send(ClientInstruction::StartedParsingStdinQuery)
diff --git a/zellij-client/src/lib.rs b/zellij-client/src/lib.rs
index bef96e25..482a105d 100644
--- a/zellij-client/src/lib.rs
+++ b/zellij-client/src/lib.rs
@@ -387,6 +387,7 @@ pub(crate) enum InputInstruction {
#[allow(dead_code)] // constructed in stdin_handler_windows.rs (Windows-only)
MouseEvent(zellij_utils::input::mouse::MouseEvent),
AnsiStdinInstructions(Vec<AnsiStdinInstruction>),
+ DesktopNotificationResponse(Vec<u8>),
StartedParsing,
DoneParsing,
Exit,
diff --git a/zellij-client/src/stdin_handler.rs b/zellij-client/src/stdin_handler.rs
index 99975674..dc948b06 100644
--- a/zellij-client/src/stdin_handler.rs
+++ b/zellij-client/src/stdin_handler.rs
@@ -200,12 +200,28 @@ pub(crate) fn stdin_loop(
);
for input_event in events.into_iter() {
- send_input_instructions
- .send(InputInstruction::KeyEvent(
- input_event,
- current_buffer.drain(..).collect(),
- ))
- .unwrap();
+ match input_event {
+ InputEvent::OperatingSystemCommand(ref payload) => {
+ if payload.starts_with(b"99;") {
+ let notification_payload =
+ payload.get(3..).unwrap_or_default().to_vec();
+ let _ = send_input_instructions.send(
+ InputInstruction::DesktopNotificationResponse(
+ notification_payload,
+ ),
+ );
+ }
+ // Other OSC types at runtime: silently drop.
+ },
+ other => {
+ send_input_instructions
+ .send(InputInstruction::KeyEvent(
+ other,
+ current_buffer.drain(..).collect(),
+ ))
+ .unwrap();
+ },
+ }
}
needs_finalization = true;
@@ -252,11 +268,24 @@ fn finalize_events(
false,
);
for input_event in events {
- send_input_instructions
- .send(InputInstruction::KeyEvent(
- input_event,
- current_buffer.drain(..).collect(),
- ))
- .unwrap();
+ match input_event {
+ InputEvent::OperatingSystemCommand(ref payload) => {
+ if payload.starts_with(b"99;") {
+ let notification_payload = payload.get(3..).unwrap_or_default().to_vec();
+ let _ = send_input_instructions.send(
+ InputInstruction::DesktopNotificationResponse(notification_payload),
+ );
+ }
+ // Other OSC types at runtime: silently drop.
+ },
+ other => {
+ send_input_instructions
+ .send(InputInstruction::KeyEvent(
+ other,
+ current_buffer.drain(..).collect(),
+ ))
+ .unwrap();
+ },
+ }
}
}