summary refs log tree commit diff stats
path: root/user/zsh
diff options
context:
space:
mode:
authorAlan Pearce2021-04-13 13:51:43 +0200
committerAlan Pearce2021-04-13 13:51:43 +0200
commit4e3bd398ca7a1d6625bb51f05921d3b1324e811f (patch)
tree21979847a6e59c405ac76e44e2b7551a3c22465a /user/zsh
parent533ae2186750c603f560301997f02e8328f5ad38 (diff)
downloadnixfiles-4e3bd398ca7a1d6625bb51f05921d3b1324e811f.tar.lz
nixfiles-4e3bd398ca7a1d6625bb51f05921d3b1324e811f.tar.zst
nixfiles-4e3bd398ca7a1d6625bb51f05921d3b1324e811f.zip
zsh: set/re-set terminal title from ssh/mosh on Darwin
Diffstat (limited to 'user/zsh')
-rw-r--r--user/zsh/zshrc.darwin26
1 files changed, 26 insertions, 0 deletions
diff --git a/user/zsh/zshrc.darwin b/user/zsh/zshrc.darwin
new file mode 100644
index 00000000..1b702022
--- /dev/null
+++ b/user/zsh/zshrc.darwin
@@ -0,0 +1,26 @@
+set_title () {
+  print -Pn "\e]0;$1\7\n"
+}
+ssh () {
+  local arg server retval
+  for arg
+  do
+    if [[ "${arg#-}" == "$arg" ]]
+    then
+      server=$arg
+      break
+    fi
+  done
+  set_title "file://${server}/"
+  command ssh "$@"
+  retval=$?
+  set_title
+  return $retval
+}
+mosh () {
+  command mosh "$@"
+  retval=$?
+  set_title
+  return $retval
+}
+