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