From d3f14414812860d19bcadb68c555f6677e493610 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 9 Oct 2014 23:31:01 -0400 Subject: [PATCH] [Fix #595] Simplify the handling of the Terminal.app proxy icon --- modules/terminal/init.zsh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/terminal/init.zsh b/modules/terminal/init.zsh index cec0bfa..01140d8 100644 --- a/modules/terminal/init.zsh +++ b/modules/terminal/init.zsh @@ -78,11 +78,6 @@ function _terminal-set-titles-with-path { set-tab-title "$truncated_path" } -# Sets the Terminal.app proxy icon. -function _terminal-set-terminal-app-proxy-icon { - printf '\e]7;%s\a' "file://$HOST${${1:-$PWD}// /%20}" -} - # Do not override precmd/preexec; append to the hook array. autoload -Uz add-zsh-hook @@ -92,6 +87,9 @@ if [[ "$TERM_PROGRAM" == 'Apple_Terminal' ]] \ then # Sets the Terminal.app current working directory before the prompt is # displayed. + function _terminal-set-terminal-app-proxy-icon { + printf '\e]7;%s\a' "file://${HOST}${PWD// /%20}" + } add-zsh-hook precmd _terminal-set-terminal-app-proxy-icon # Unsets the Terminal.app current working directory when a terminal @@ -100,7 +98,7 @@ then # bar is no longer synchronized with real current working directory. function _terminal-unset-terminal-app-proxy-icon { if [[ "${2[(w)1]:t}" == (screen|tmux|dvtm|ssh|mosh) ]]; then - _terminal-set-terminal-app-proxy-icon ' ' + print '\e]7;\a' fi } add-zsh-hook preexec _terminal-unset-terminal-app-proxy-icon