X-Git-Url: https://git.distorted.org.uk/~mdw/profile/blobdiff_plain/1e0b3449d6ffbf89d4e0f5c7ed5efa030d74079e..be6f67499ecde598ec78e231fc64a0710a45633e:/dot/shell-rc diff --git a/dot/shell-rc b/dot/shell-rc index e29ac37..55a245f 100644 --- a/dot/shell-rc +++ b/dot/shell-rc @@ -61,7 +61,8 @@ __mdw_runhook () { ###-------------------------------------------------------------------------- ### Prompt machinery. -__mdw_set_prompt_hacks () { host=$(hostname); dir=""; } +__mdw_host=$(hostname) +__mdw_set_prompt_hacks () { host=$__mdw_host; dir=""; } __mdw_set_prompt_pieces () { local hqual @@ -145,12 +146,19 @@ __mdw_set_prompt () { esac } -__mdw_screen_precmd () { printf "k%s\\" "$__mdw_shell"; } -__mdw_screen_preexec () { printf "k%s\\" "$1"; } +__mdw_xterm_precmd () { printf >/dev/tty "]2;%s@%s:%s – %s\\" "$USER" "$__mdw_host" "$PWD" "$__mdw_shell"; } +__mdw_xterm_preexec () { printf >/dev/tty "]2;%s@%s:%s – %s\\" "$USER" "$__mdw_host" "$PWD" "$1"; } + +__mdw_screen_precmd () { printf >/dev/tty "k%s\\" "$__mdw_shell"; } +__mdw_screen_preexec () { printf >/dev/tty "k%s\\" "$1"; } if [ -t 0 ]; then - case ${STY+t},${__mdw_precmd_hook+t},${__mdw_preexec_hook+t} in - t,t,t) + case ${STY+t},${__mdw_precmd_hook+t},${__mdw_preexec_hook+t},${TERM} in + ,t,t,xterm*) + __mdw_addhook __mdw_precmd_hook __mdw_xterm_precmd + __mdw_addhook __mdw_preexec_hook __mdw_xterm_preexec + ;; + t,t,t,*) __mdw_addhook __mdw_precmd_hook __mdw_screen_precmd __mdw_addhook __mdw_preexec_hook __mdw_screen_preexec ;;