summaryrefslogtreecommitdiff
path: root/lib/termsupport.zsh
diff options
context:
space:
mode:
authorAndrew Janke <janke@pobox.com>2014-12-20 02:24:26 -0500
committerMarc Cornellà <marc.cornella@live.com>2015-02-10 19:38:11 +0100
commit4fc6dccb4286828c7cd53d3612ec69b0c0d9aaf2 (patch)
treee051ccae3d5f080065aff41da8fdbbbd58430258 /lib/termsupport.zsh
parent13e5afe805f28749f4aa6a5e82272760a62ad573 (diff)
downloadzsh-4fc6dccb4286828c7cd53d3612ec69b0c0d9aaf2.tar.gz
zsh-4fc6dccb4286828c7cd53d3612ec69b0c0d9aaf2.tar.bz2
zsh-4fc6dccb4286828c7cd53d3612ec69b0c0d9aaf2.zip
term: Move DISABLE_AUTO_TITLE check to hooks
Move the DISABLE_AUTO_TITLE check from title() to the preX hook functions that call it, to allow the title() function to be used directly by user or other callers.
Diffstat (limited to 'lib/termsupport.zsh')
-rw-r--r--lib/termsupport.zsh24
1 files changed, 20 insertions, 4 deletions
diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
index bd0cf6ffe..2fa61c431 100644
--- a/lib/termsupport.zsh
+++ b/lib/termsupport.zsh
@@ -1,8 +1,16 @@
-#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
+ if [[ $2 == "" ]]; then
+ 2="$1"
+ fi
+ if [[ "$EMACS" == *term* ]]; then
return
fi
if [[ "$TERM" == screen* ]]; then
@@ -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