summaryrefslogtreecommitdiff
path: root/pym
diff options
context:
space:
mode:
authorJason Stubbs <jstubbs@gentoo.org>2005-12-25 07:42:00 +0000
committerJason Stubbs <jstubbs@gentoo.org>2005-12-25 07:42:00 +0000
commitb3131da61a07d55f06938378a6be38f9cbd69381 (patch)
treedc4a6904ba95b0e6ed937e382dbb7d1dd2761f35 /pym
parent- only record vdb entries when the value is non null (diff)
downloadportage-multirepo-b3131da61a07d55f06938378a6be38f9cbd69381.tar.gz
portage-multirepo-b3131da61a07d55f06938378a6be38f9cbd69381.tar.bz2
portage-multirepo-b3131da61a07d55f06938378a6be38f9cbd69381.zip
Use the env's PROMPT_COMMAND for resetting xterm titles when available.
Otherwise use ${user}@${hostname}:${cwd}. svn path=/main/trunk/; revision=2454
Diffstat (limited to 'pym')
-rw-r--r--pym/output.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/pym/output.py b/pym/output.py
index 69dcb539..ec538f27 100644
--- a/pym/output.py
+++ b/pym/output.py
@@ -3,7 +3,7 @@
# $Id: /var/cvsroot/gentoo-src/portage/pym/output.py,v 1.24.2.4 2005/04/17 09:01:55 jstubbs Exp $
-import os,sys,re
+import commands,os,sys,re
havecolor=1
dotitles=1
@@ -102,11 +102,12 @@ def xtermTitle(mystr):
sys.stderr.flush()
break
-def xtermTitleReset():
- if havecolor and dotitles and os.environ.has_key("TERM"):
- myt=os.environ["TERM"]
- xtermTitle(os.environ["TERM"])
+prompt_command = os.getenv("PROMPT_COMMAND", 'echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"')
+default_xterm_title = commands.getoutput(prompt_command)
+del prompt_command
+def xtermTitleReset():
+ xtermTitle(default_xterm_title)
def notitles():
"turn off title setting"