Browse Source

Be smarter about terminal title icon

First, I'm not sure where I took the former icon, but it does not work
out of the bos on Fedora, so I decided to use another one rather than
try to find out.

Also when a system is accessed via SSH, it will use different
(fa-server) icon.
Alois Mahdal 7 years ago
parent
commit
d9db4da860
1 changed files with 10 additions and 3 deletions
  1. 10
    3
      dotfiles/bash/post.bashrc

+ 10
- 3
dotfiles/bash/post.bashrc View File

@@ -82,12 +82,12 @@ __bashum__set_title() {
82 82
             # output them.
83 83
             ;;
84 84
         "")
85
-            echo -ne "\033]0; "
85
+            echo -ne "\033]0;$(__bashum__mkicon) "
86 86
             echo -n    "$(__bashum__lastrv)$(__bashum__mkhostid)${PWD/$HOME/\~}\$"
87 87
             echo -ne "\007"
88 88
             ;;
89 89
         *)
90
-            echo -ne "\033]0; "
90
+            echo -ne "\033]0;$(__bashum__mkicon) "
91 91
             echo -n    "${BASH_COMMAND} ($(__bashum__mkhostid)${PWD/$HOME/\~})"
92 92
             echo -ne "\007"
93 93
             ;;
@@ -103,7 +103,7 @@ __bashum__mkpc() {
103 103
     case "$TERM" in
104 104
         xterm*|rxvt*|screen*)
105 105
             echo -n 'echo -ne "\033]0;'
106
-            echo -n   ' '
106
+            echo -n   "$(__bashum__mkicon) "
107 107
             echo -n   '$(__bashum__lastrv)'
108 108
             echo -n   "$(__bashum__mkhostid)"
109 109
             echo -n   '${PWD/$HOME/\~}'
@@ -113,6 +113,13 @@ __bashum__mkpc() {
113 113
     esac
114 114
 }
115 115
 
116
+__bashum__mkicon() {
117
+    case "$SSH_CONNECTION" in
118
+        "") echo  ;;
119
+        *)  echo  ;;
120
+    esac
121
+}
122
+
116 123
 __bashum__mkhostid() {
117 124
     test -n "$SSH_CONNECTION" || return
118 125
     echo "${HOSTNAME%%.*}:"