.profile: remove PROMPT_COMMAND, set titles from PS1
authorOleg Broytman <phd@phdru.name>
Mon, 22 Feb 2016 18:10:31 +0000 (21:10 +0300)
committerOleg Broytman <phd@phdru.name>
Mon, 22 Feb 2016 21:21:25 +0000 (00:21 +0300)
.profile

index 5eab941..4b7368a 100644 (file)
--- a/.profile
+++ b/.profile
@@ -139,7 +139,24 @@ if [ -t 0 ] ; then
    case "$SHELL" in
       */bash)
          shopt -s checkwinsize
-         OPS1='\u@\h '
+         # display the user, host and current working directory
+         # in the terminal title
+         case "$TERM" in
+            *rxvt*|screen*|*term*|vt100)
+               OPS1="\[\033]0;\u@\h:\w\007\]"
+               case "$TERM" in
+                  screen*)
+                     OPS1+"\[\033k\u@\h:\w\033\\\]" # Set screen/tmux caption
+                  ;;
+               esac
+            ;;
+
+            *)
+               OPS1=""
+            ;;
+         esac
+
+         OPS1+="\u@\h \W "
          . "$ENV"
          ;;
       *)
@@ -147,16 +164,8 @@ if [ -t 0 ] ; then
          ;;
    esac
 
-   export OPS1
-
-   case "$TERM" in
-      *rxvt*|screen*|*term*|vt100)
-         if [ -x "`which xtitle 2>/dev/null`" ]; then
-            PROMPT_COMMAND=xtitle
-            export PROMPT_COMMAND
-         fi
-      ;;
-   esac
+   #PROMPT_DIRTRIM=2
+   export OPS1 # PROMPT_DIRTRIM
 
    ### biff controls new mail notification
    #biff n