mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-21 21:30:09 +00:00
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 changed files with 23 additions and 7 deletions
|
@ -1,13 +1,21 @@
|
|||
#usage: title short_tab_title looooooooooooooooooooooggggggg_windows_title
|
||||
#http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
|
||||
#Fully support screen, iterm, and probably most modern xterm and rxvt
|
||||
# Set terminal window and tab/icon title
|
||||
#
|
||||
# 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 {
|
||||
if [[ "$DISABLE_AUTO_TITLE" == "true" ]] || [[ "$EMACS" == *term* ]]; then
|
||||
return
|
||||
fi
|
||||
[[ "$EMACS" == *term* ]] && return
|
||||
|
||||
# if $2 is unset use $1 as default
|
||||
# if it is set and empty, leave it as is
|
||||
: ${2=$1}
|
||||
|
||||
if [[ "$TERM" == screen* ]]; then
|
||||
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]1;$1:q\a" #set icon (=tab) name
|
||||
fi
|
||||
|
@ -18,6 +26,10 @@ ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~"
|
|||
|
||||
# Runs before showing the prompt
|
||||
function omz_termsupport_precmd {
|
||||
if [[ $DISABLE_AUTO_TITLE == true ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
|
||||
|
||||
# Notify Terminal.app of current directory using undocumented OSC sequence
|
||||
|
@ -30,6 +42,10 @@ function omz_termsupport_precmd {
|
|||
|
||||
# Runs before executing the command
|
||||
function omz_termsupport_preexec {
|
||||
if [[ $DISABLE_AUTO_TITLE == true ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
emulate -L zsh
|
||||
setopt extended_glob
|
||||
|
||||
|
|
Loading…
Reference in a new issue