1

I see that there are ways to set the tabs title through the CLI, but how can I give each tab its own "title"?

  1. top
  2. pine
  3. git

by default, gnome-terminal seems to show <user>@<host>:<path>, which gets cumbersome beyond two tabs, IMHO.

(creating umpteen profiles is way to awkward to be a solution)

Notably, Alpine seems to magically (through the CLI?) set the tab title:

enter image description here

Thufir
  • 4,551

3 Answers3

2

As taken from SuperUser.com,

The process is a little complex to explain here since it is different for every shell you use. Rather I'll give you two links:

There are a few other things to take into consideration. For a one time change common to all terminal sessions, you may want instead to simply alter Bash (if you use bash and under gnome) icon and add --title=title under Gnome.

David
  • 3,367
1

The title can be set using escape sequences as shown in How to change xterm title. ( Specifically for bash ).

In their example, they use case statement that sets PS1 with an enclosed escape sequence.

case $TERM in
    xterm*)
        PS1="\[\033]0;\u@\h: \w\007\]bash\\$ "
        ;;
    *)
        PS1="bash\\$ "
        ;;
esac

The basic idea is to echo echo -e "\033]0; STRING\007" ( The PS1 prompt needs extra \[...\] brackets to enclose the escape sequence ). Thus you could add the following function to your .bashrc at the top of the file:

function setTitle
{
   echo -e "\033]0;$@\007"
}

Now you can alter title at will

Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497
1

You could install and use xttitle (Note the doubled t in the name). I use it like this in a file sourced by my ~/.bashrc:

# from the "xttitle(1)" man page - put info in window title
update_title()
{
    [ $TERM = xterm -o $TERM = xterm-color ] && xttitle "[$$] ${USER}@${HOSTNAME}:$PWD"
}

cd()
{
    [ -z "$*" ] && builtin cd $HOME
    [ -n "$*" ] && builtin cd "$*"
    update_title
}

I also do this:

xttitle Mutt && mutt
waltinator
  • 36,399