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