Files
paseo/packages/server/src/terminal/shell-integration/zsh/paseo-integration.zsh
T
Mohamed Boudra cea97c83b3 Reuse terminals for non-service scripts and track lifecycle via OSC 633
Scripts launched from the UI now run in a dedicated terminal per script
(titled after the script) and reuse the same terminal across re-runs.
Script lifecycle is driven by a new onCommandFinished signal sourced from
OSC 633 command-finished events emitted by the zsh shell integration, so
foreground script exit updates status without killing the terminal.
Script payloads now carry terminalId so the workspace can surface the
associated tab from the scripts dropdown.
2026-04-21 17:12:53 +07:00

33 lines
677 B
Bash

if [[ -n "${_PASEO_ZSH_INTEGRATION_LOADED-}" ]]; then
return
fi
typeset -g _PASEO_ZSH_INTEGRATION_LOADED=1
autoload -Uz add-zsh-hook
typeset -g _PASEO_ZSH_COMMAND_ACTIVE=0
function _paseo_osc633() {
printf '\e]633;%s\a' "$1"
}
function _paseo_precmd() {
local command_status=$?
if [[ "$_PASEO_ZSH_COMMAND_ACTIVE" == "1" ]]; then
_paseo_osc633 "D;${command_status}"
_PASEO_ZSH_COMMAND_ACTIVE=0
fi
printf '\e]2;%s\a' "${PWD/#$HOME/~}"
_paseo_osc633 "A"
}
function _paseo_preexec() {
_PASEO_ZSH_COMMAND_ACTIVE=1
_paseo_osc633 "B"
_paseo_osc633 "C"
printf '\e]2;%s\a' "$1"
}
add-zsh-hook precmd _paseo_precmd
add-zsh-hook preexec _paseo_preexec