summary refs log tree commit diff stats
path: root/tag-zsh/config/zsh/zshrc
diff options
context:
space:
mode:
Diffstat (limited to 'tag-zsh/config/zsh/zshrc')
-rw-r--r--tag-zsh/config/zsh/zshrc12
1 files changed, 12 insertions, 0 deletions
diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc
index 7b3d332..e1f5555 100644
--- a/tag-zsh/config/zsh/zshrc
+++ b/tag-zsh/config/zsh/zshrc
@@ -217,6 +217,18 @@ else
     # Run once to get initial cwd set
     update_terminalapp_cwd
   fi
+
+  function set_window_title { printf '\e]2;%s\a' "$1" }
+
+  function update_window_title {
+    if [[ -n "$SSH_CONNECTION" || $UID -eq 0 ]]
+    then
+      set_window_title "$USER@$HOST"
+    else
+      set_window_title ""
+    fi
+  }
+  precmd_functions+=(update_window_title)
 fi
 
 if zplug check clvv/fasd