Add support $NOTITLE variable
authorFrank Terbeck <ft@bewatermyfriend.org>
Tue, 24 Feb 2009 19:42:57 +0000 (20:42 +0100)
committerFrank Terbeck <ft@bewatermyfriend.org>
Tue, 24 Feb 2009 19:45:57 +0000 (20:45 +0100)
'NOTITLE=1 zsh' allows the user to disable the alteration of terminal
titles without completely disabling the precmd() and preexec() functions
(in contrast to the already existing $NOPRECMD variable, which achieves
a similar result by doing exactly that).

debian/changelog
etc/zsh/zshrc

index 9739df2..a343624 100644 (file)
@@ -1,3 +1,10 @@
+grml-etc-core (0.3.65) unstable; urgency=low
+
+  * zshrc: Add $NOTITLE to disable alteration of terminal titles.
+    Based on an idea by Timo Boettcher.
+
+ -- Frank Terbeck <ft@grml.org>  Tue, 24 Feb 2009 20:44:29 +0100
+
 grml-etc-core (0.3.64) unstable; urgency=low
 
   * zshrc: rewrite of zurl() by Alexander Steinböck [Closes: issue627]
index cb911c1..cf22e1c 100644 (file)
@@ -1961,6 +1961,8 @@ setopt prompt_subst
 # make sure to use right prompt only when not running a command
 is41 && setopt transient_rprompt
 
+# TODO: revise all these NO* variables and especially their documentation
+#       in zsh-help() below.
 is4 && [[ $NOPRECMD -eq 0 ]] && precmd () {
     [[ $NOPRECMD -gt 0 ]] && return 0
     # update VCS information
@@ -1985,6 +1987,7 @@ is4 && [[ $NOPRECMD -eq 0 ]] && precmd () {
     fi
     # adjust title of xterm
     # see http://www.faqs.org/docs/Linux-mini/Xterm-Title.html
+    [[ NOTITLE -gt 0 ]] && return 0
     case $TERM in
         (xterm*|rxvt*)
             print -Pn "\e]0;%n@%m: %~\a"
@@ -2008,6 +2011,7 @@ preexec () {
         echo -ne "\ek$CMD\e\\"
     fi
 # adjust title of xterm
+    [[ NOTITLE -gt 0 ]] && return 0
     case $TERM in
         (xterm*|rxvt)
             print -Pn "\e]0;%n@%m: $1\a"
@@ -2230,6 +2234,8 @@ the zsh yet. :)
   "NOCOR=1    zsh" => deactivate automatic correction
   "NOMENU=1   zsh" => do not use auto menu completion (note: use ctrl-d for completion instead!)
   "NOPRECMD=1 zsh" => disable the precmd + preexec commands (set GNU screen title)
+  "NOTITLE=1  zsh" => disable setting the title of xterms without disabling
+                      preexec() and precmd() completely
   "BATTERY=1  zsh" => activate battery status (via acpi) on right side of prompt
 
 A value greater than 0 is enables a feature; a value equal to zero