Merge pull request #3568 from mcornella/apjanke-title-disable-check
Repost #3426: move DISABLE_AUTO_TITLE check to hooks
This commit is contained in:
commit
ef7e53a78d
|
@ -1,13 +1,21 @@
|
||||||
#usage: title short_tab_title looooooooooooooooooooooggggggg_windows_title
|
# Set terminal window and tab/icon title
|
||||||
#http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
|
#
|
||||||
#Fully support screen, iterm, and probably most modern xterm and rxvt
|
# usage: title short_tab_title [long_window_title]
|
||||||
|
#
|
||||||
|
# See: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
|
||||||
|
# Fully supports screen, iterm, and probably most modern xterm and rxvt
|
||||||
|
# (In screen, only short_tab_title is used)
|
||||||
|
# Limited support for Apple Terminal (Terminal can't set window and tab separately)
|
||||||
function title {
|
function title {
|
||||||
if [[ "$DISABLE_AUTO_TITLE" == "true" ]] || [[ "$EMACS" == *term* ]]; then
|
[[ "$EMACS" == *term* ]] && return
|
||||||
return
|
|
||||||
fi
|
# if $2 is unset use $1 as default
|
||||||
|
# if it is set and empty, leave it as is
|
||||||
|
: ${2=$1}
|
||||||
|
|
||||||
if [[ "$TERM" == screen* ]]; then
|
if [[ "$TERM" == screen* ]]; then
|
||||||
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
|
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
|
||||||
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ $TERM == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == rxvt* ]] || [[ "$TERM" == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||||
print -Pn "\e]2;$2:q\a" #set window name
|
print -Pn "\e]2;$2:q\a" #set window name
|
||||||
print -Pn "\e]1;$1:q\a" #set icon (=tab) name
|
print -Pn "\e]1;$1:q\a" #set icon (=tab) name
|
||||||
fi
|
fi
|
||||||
|
@ -18,6 +26,10 @@ ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~"
|
||||||
|
|
||||||
# Runs before showing the prompt
|
# Runs before showing the prompt
|
||||||
function omz_termsupport_precmd {
|
function omz_termsupport_precmd {
|
||||||
|
if [[ $DISABLE_AUTO_TITLE == true ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
|
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
|
||||||
|
|
||||||
# Notify Terminal.app of current directory using undocumented OSC sequence
|
# Notify Terminal.app of current directory using undocumented OSC sequence
|
||||||
|
@ -30,6 +42,10 @@ function omz_termsupport_precmd {
|
||||||
|
|
||||||
# Runs before executing the command
|
# Runs before executing the command
|
||||||
function omz_termsupport_preexec {
|
function omz_termsupport_preexec {
|
||||||
|
if [[ $DISABLE_AUTO_TITLE == true ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
emulate -L zsh
|
emulate -L zsh
|
||||||
setopt extended_glob
|
setopt extended_glob
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue