Ask Your Question

Revision history [back]

Add the following in your ~/.zshrc file:

zsh__vte_prompt_command () {
        local command=$(HISTTIMEFORMAT= fc -l -1 | sed 's/^ *[0-9]\+ *//')
        command="${command//;/ }"
        local pwd='~'
        [ "$PWD" != "$HOME" ] && pwd=${PWD/#$HOME\//\~\/}
        printf "\033]777;notify;Command completed;%s\007\033]0;%s@%s:%s\007%s" "${command}" "${USER}" "${HOSTNAME%%.*}" "${pwd}" "$(__vte_osc7)"
}

precmd () {
    if which __vte_prompt_command &> /dev/null; then
            zsh__vte_prompt_command
    fi
}

Note: if it already contains a precmd() function, add these 3 lines in that function. or you might use precmd_functions approach which I don't describe but is easy to find...