From 4396ad7909281923ea8e7f25629e343a35d0dd29 Mon Sep 17 00:00:00 2001 From: Vassiliy Yegorov Date: Tue, 9 Jun 2026 23:00:48 +0700 Subject: [PATCH] feat(daemon): zsh OSC 133 shell integration via per-surface ZDOTDIR Co-Authored-By: Claude Opus 4.8 (1M context) --- .../spaceshd/src/shell_integration/spacesh.zsh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 crates/spaceshd/src/shell_integration/spacesh.zsh diff --git a/crates/spaceshd/src/shell_integration/spacesh.zsh b/crates/spaceshd/src/shell_integration/spacesh.zsh new file mode 100644 index 0000000..ac8b12d --- /dev/null +++ b/crates/spaceshd/src/shell_integration/spacesh.zsh @@ -0,0 +1,16 @@ +# spacesh zsh OSC 133 integration. Sourced from a per-surface ZDOTDIR .zshrc +# after the user's ~/.zshrc. Emits semantic-prompt markers so the daemon can +# detect command start/end and exit status. +autoload -Uz add-zsh-hook 2>/dev/null + +_spacesh_precmd() { + local code=$? + # End previous command (D) with its exit code, then mark prompt start (A). + print -n "\e]133;D;${code}\a\e]133;A\a" +} +_spacesh_preexec() { + # Command output begins (C). + print -n "\e]133;C\a" +} +add-zsh-hook precmd _spacesh_precmd 2>/dev/null +add-zsh-hook preexec _spacesh_preexec 2>/dev/null