Browse Source

Include exit status in window title as well

Alois Mahdal 10 years ago
parent
commit
de3f72538d
1 changed files with 4 additions and 5 deletions
  1. 4
    5
      dotfiles/bash/post.bashrc

+ 4
- 5
dotfiles/bash/post.bashrc View File

31
 make_ps1() {
31
 make_ps1() {
32
     # these functions must be already defined by ~/.bash/user/*.bashrc
32
     # these functions must be already defined by ~/.bash/user/*.bashrc
33
     # and ~/.bash/host/*.bashrc
33
     # and ~/.bash/host/*.bashrc
34
-    local svrc='$(__save_rv $?)'
35
     local ps1u=$(make_ps1u)
34
     local ps1u=$(make_ps1u)
36
     local ps1h=$(make_ps1h)
35
     local ps1h=$(make_ps1h)
37
     local ps1w="$lblue\w$normal";
36
     local ps1w="$lblue\w$normal";
38
     local ps1G='$(__git_ps1 "(%s)")';
37
     local ps1G='$(__git_ps1 "(%s)")';
39
     local ps1g="$green$ps1G$normal";
38
     local ps1g="$green$ps1G$normal";
40
-    local ps1D='$(__make_ps1d)';
39
+    local ps1D='$(__make_ps1d -r)';
41
     local ps1d="$lred$ps1D$normal";
40
     local ps1d="$lred$ps1D$normal";
42
-    echo "$svrc$ps1u@$ps1h:$ps1w$ps1g$ps1d\$ ";
41
+    echo "$ps1u@$ps1h:$ps1w$ps1g$ps1d\$ ";
43
 }
42
 }
44
 
43
 
45
 make_ps2() {
44
 make_ps2() {
56
 
55
 
57
 case "$TERM" in
56
 case "$TERM" in
58
 xterm*|rxvt*|screen*)
57
 xterm*|rxvt*|screen*)
59
-    PROMPT_COMMAND='echo -ne "\033]0;${PWD/$HOME/~}\$\007"'
58
+    PROMPT_COMMAND='__save_rv $?; echo -ne "\033]0;$(__make_ps1d)${PWD/$HOME/~}\$\007"'
60
 
59
 
61
     # Show the currently running command in the terminal title:
60
     # Show the currently running command in the terminal title:
62
     # http://www.davidpashley.com/articles/xterm-titles-with-bash.html
61
     # http://www.davidpashley.com/articles/xterm-titles-with-bash.html
74
                 then
73
                 then
75
                     echo -ne "\033]0;${BASH_COMMAND} (${PWD/$HOME/~})\007"
74
                     echo -ne "\033]0;${BASH_COMMAND} (${PWD/$HOME/~})\007"
76
                 else
75
                 else
77
-                    echo -ne "\033]0;${PWD/$HOME/~}\$\007"
76
+                    echo -ne "\033]0;$(__make_ps1d)${PWD/$HOME/~}\$\007"
78
                 fi
77
                 fi
79
                 ;;
78
                 ;;
80
         esac
79
         esac