diff options
author | Toby Vincent <tobyv13@gmail.com> | 2022-03-11 14:38:15 -0600 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2022-03-11 14:38:15 -0600 |
commit | e610a34a46669a77799c2bb7b4cd043ef228f544 (patch) | |
tree | 80091ad251b8f2ea17551895354a2da1f035b38f /bashrc | |
parent | 0d3b11c231b5d8536fdc8fbddf167956ec999cc6 (diff) |
feat: improved win title
Diffstat (limited to 'bashrc')
-rw-r--r-- | bashrc | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -7,7 +7,18 @@ if [ -d "$comp_dir" ]; then for f in "$comp_dir"/*; do source $f; done; fi command -v starship >/dev/null 2>&1 && eval "$(starship init bash)" -function set_win_title() { - echo -ne "\033]0;$USER@$HOSTNAME: ${PWD/$HOME/'~'}\007" +set_win_title() { + local prefix + + if [ "$USER" != "tobyv" ]; then + prefix="${USER} in " + fi + + if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then + prefix="${prefix/in/on}${HOSTNAME} in " + fi + + echo -ne "\033]0;${prefix}${PWD/$HOME/~}\007" } + starship_precmd_user_func="set_win_title" |