From 5633dbd71e356bd0539122556ef7630518b94cbf Mon Sep 17 00:00:00 2001 From: David Alexander Majnemer Date: Fri, 16 Jan 2009 14:38:56 -0500 Subject: [PATCH 1/2] add support for a lot more terms and screen for bash's titles --- bash/title_prompt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bash/title_prompt b/bash/title_prompt index f9dbcec..ba989f0 100755 --- a/bash/title_prompt +++ b/bash/title_prompt @@ -10,15 +10,21 @@ function do_prompt () else BASE="#" fi + + local TITLEBAR case $TERM in - xterm*) + xterm*|*rxvt*|cygwin|interix|Eterm|mlterm|kterm|aterm|putty*) TITLEBAR='\[\033]0;\u@\h:\w\007\]' ;; + screen*) + TITLEBAR='\[\033k\033\134\033k\u@\h:\w\033\134\]' + ;; *) TITLEBAR='' ;; esac - export PS1="${TITLEBAR}\[\033[01;32m\]\u@\h \[\033[01;34m\]\w ${ERROR_PROMPT}${BASE} \[\033[00m\]" + PS1="${TITLEBAR}\[\033[01;32m\]\u@\h \[\033[01;34m\]\w ${ERROR_PROMPT}${BASE} \[\033[00m\]" + export PS1 } PROMPT_COMMAND=do_prompt From 6e6cb7a85cb027169ccc6594ee0e118ff6fb2d70 Mon Sep 17 00:00:00 2001 From: David Alexander Majnemer Date: Fri, 16 Jan 2009 14:41:10 -0500 Subject: [PATCH 2/2] move ksh's prompt to title_prompt as it now has support for this functionality --- ksh/prompt | 12 ------------ ksh/title_prompt | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 12 deletions(-) delete mode 100755 ksh/prompt create mode 100755 ksh/title_prompt diff --git a/ksh/prompt b/ksh/prompt deleted file mode 100755 index a25ce36..0000000 --- a/ksh/prompt +++ /dev/null @@ -1,12 +0,0 @@ -if [ -z "${USER}" ] ; then - USER=$LOGNAME -fi - -if [ -n "${USER}" ] && [ ${USER} = root ] ; then - BASE="#" -else - BASE="$" -fi - -PS1=$'\E[01;32m'"${USER} "$'\E[01;34m''$PWD'" ${BASE} "$'\E[0m' -export PS1 diff --git a/ksh/title_prompt b/ksh/title_prompt new file mode 100755 index 0000000..cd8f613 --- /dev/null +++ b/ksh/title_prompt @@ -0,0 +1,24 @@ +if [ -z "${USER}" ] ; then + USER=$LOGNAME +fi + +if [ -n "${USER}" ] && [ ${USER} = root ] ; then + BASE="#" +else + BASE="$" +fi + +case $TERM in + xterm*|*rxvt*|cygwin|interix|Eterm|mlterm|kterm|aterm|putty*) + TITLE=']0;${USER}:${PWD}' + ;; + screen*) + TITLE='k\\k${USER}:${PWD}\\' + ;; + *) + TITLE='' + ;; +esac + +PS1=$TITLE$'\E[01;32m'"${USER} "$'\E[01;34m''$PWD'" ${BASE} "$'\E[0m' +export PS1