In Ubuntu 14.10, if I had multiple Terminal Tabs open, I could right-click a Terminal tab and rename it. In Ubuntu 15.04 I can't find this feature.
Is there a easy way to get it back?
This is the current version:
$ gnome-terminal --version
GNOME Terminal 3.14.2
The
.bashrc
solution proposed by Kirby worked for me:then from my prompt:
$ set-title test-title
Answered here
I quote:
I can't believe they removed such a user friendly feature like this one.
I'm switching to ROXTerm (http://roxterm.sourceforge.net), which does the job nicely. It's packaged in Ubuntu:
Then, let the dinosaur continue its own way ;-)
I've tried RoxTerm as suggested above, with good results. But I settled on MATE Terminal, which is part of the MATE Project, a continuation of Gnome 2, on 15.04:
That terminal is based on the Gnome Terminal code.
Commentary: It's hard to understand the mindset of the Gnome Terminal devs. There's a lot of discussion over there about "how" to name terminal tabs, and how it's difficult to get right. If that's the case, why make it harder for the user to name them? Not very smart at all.
Now I've investigated this for the better part of a day and finally found a way to set this title. It's done via escape sequences which start with \e]0; and end with a BEL character ( = \007 = \a). Unlike I stated above, communications from the shell back to the terminal application is possible, very limited, through such escape sequences (there are a few more).
About this from above:
It can work, but it doesn't always.
PROMPT_COMMAND
is a variable which contents is executed each time you send a command, so it also sends this escape sequence. However, this can be overriden by an escape sequence in the PS1 variable, which sets the command line prompt. This is why the above had no effect here.From an older Ubuntu installation I grabbed this, which sets the command prompt (right part, after the
]
) and also sends the required escape sequence (left part, up to and including the]
):This likely performs better, because there's no need to interpret
$PROMPT_COMMAND
each time. It also has many more options, because Bash has more escape sequences here, e.g.\u
for the current user name,\W
for the current directory name or\w
for the entire path of the current working directory, optionally trimmed to just the last few by the number in$PROMPT_DIRTRIM
. See chapterPROMPTING
in the Bash man page. Also take note that the escape sequence has additionally to be surrounded by\[
and\]
here.To set a fixed title, this works:
Enjoy!
During my investigation I also tried to understand gnome-terminal source code, which leads to vte source code and there the support for title setting and reading escape sequences is considered to be a security risk: See here (case 20, case 21) and here ("Window Title Reporting").
Setting $PROMPT_COMMAND as shown above has zero effect here. No surprise, because Bash runs inside the terminal and parent processes (here: gnome-terminal) can't read a child's environment on a unix-like OS. Using something more simple, like
Executes echo bla, nothing else happens.
Edit: one has to wrap this in escape sequences, see my other answer. Despite reading the child environment isn't possible, some communication back to the parent is, through these sequences.
In Gnome bug 740188 they talk about defining a title() function in .bashrc. A different one for each tab opened? Severe ugly hacking ahead, if possible at all!
Even other explanations on Stackexchange talk about setting $PS1 (and get upvoted). Sorry, no, that's not the title, that's the command prompt.
In short: they messed it up beyond repair to save a tiny bit of space in the preferences dialog. OMG
Now, the only chance to get a developer decision reverted is to kindle a severe shitstorm, else they simply close your bug report in seconds (tried many many many times). How would we create this shitstorm?