]> git.phdru.name Git - dotfiles.git/commitdiff
Refactor(xtitle): Reuse `$TITLE`
authorOleg Broytman <phd@phdru.name>
Mon, 26 Apr 2021 16:28:44 +0000 (19:28 +0300)
committerOleg Broytman <phd@phdru.name>
Mon, 26 Apr 2021 21:00:49 +0000 (00:00 +0300)
bin/xtitle

index ce1bd66d117dd16594dbf45c8c5afb5dd76c1988..b88560ad384ae3ddb23149b4f1df64d436a9e71c 100755 (executable)
@@ -7,14 +7,13 @@ case "$TERM" in
       else
          TITLE="$@"
       fi
+      XTITLE="\033]0;${TITLE}\007" # Set xterm title/icon
       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
+            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