]> git.phdru.name Git - dotfiles.git/blobdiff - bin/xtitle
Fix(xtitle): Set xterm title/icon under screen/tmux
[dotfiles.git] / bin / xtitle
index 63bad0eea7128a770eccdde239b1718422f37951..ce1bd66d117dd16594dbf45c8c5afb5dd76c1988 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/env bash
+#! /bin/sh
 
 case "$TERM" in
    *rxvt*|screen*|*term*|vt100)
@@ -7,6 +7,14 @@ case "$TERM" in
       else
          TITLE="$@"
       fi
-      echo -ne "\033]0;${TITLE}\007"
+      case "$TERM" in
+         screen*)
+            echo -n "\033P\033]0;${TITLE}\007\033\\" # Set xterm title/icon
+            echo -n "\033k${TITLE}\033\\" # Set screen/tmux caption
+         ;;
+         *)
+            echo -n "\033]0;${TITLE}\007" # Set xterm title/icon
+         ;;
+      esac
    ;;
 esac