问题
Is there way to set terminator (Version: 0.95ppa1) title of tabs to a different string via bash command-line (CLI)?
I plan to use this feature with AutoKey and I can open multiple machines at same time and set title to Name of the machine its connected to.
回答1:
ORIG=$PS1
TITLE="\e]2;\"This is just crazy enough to work\"\a"
PS1=${ORIG}${TITLE}
Resets title to
"This is just crazy enough to work"
This should apply to all xterm-style terminal emulators.
回答2:
Add follwing in your .bashrc
file by editing it using vim ~/.bashrc
and use set_title
to rename your tab:
set_title()
{
ORIG=$PS1
TITLE="\e]2;$*\a"
PS1=${ORIG}${TITLE}
}
run source ~/.bashrc
command after editing your .bashrc
file
Ex.: set_title newtab
will rename your current tab to newtab
working Properly in Gnome3.14 terminal and terminator 0.97
回答3:
From the Terminator man pages,
Ctrl+Alt+W Rename window title.
Ctrl+Alt+A Rename tab title.
Ctrl+Alt+X Rename terminal title.
You can also launch a new instance with
$ terminator --title [title]
回答4:
PS1 does not need to be set. Credit for this function goes to geirha on freenode #bash
set_title() { printf '\e]2;%s\a' "$*"; }
回答5:
This seems to work for me. I'm using BASH on Crunchbang (Debian derived)
$ echo -en '\e]0;echo works too\a'
回答6:
With Terminator 0.96 and GNU bash 4.2.25 the printf
suggestion above worked for me, but I had to tweak it slightly to make it into a function that would just work for me in a new Terminator tab. I added this to the end of my ~/.bashrc
file:
set_title() { printf "\e]2;$*\a"; }
The key was placing the \a
at the end of the quoted string. Then when opening a new tab in Terminator I can use this like so:
set_title "My new tab title"
Apologies to those who already stated the essentials of this answer, but since I found that I had to make slight changes to get it to work for me, this my also benefit someone else.
回答7:
Try add PROMPT_COMMAND='echo -en "\033]0; $("pwd") \a"'
in your .bashrc
回答8:
For terminator 0.98 (Ubuntu 16.04 MATE), right clicking the title enables renaming it.
回答9:
Right click on terminator and choose preferences from the drop-down menu. Choose profiles tab and enable "show title bar" option. It works!!
Tip: You can actually rename each terminator window!!
回答10:
On Terminator 1.91-6 double click terminal title enables edition
来源:https://stackoverflow.com/questions/5343265/setting-title-for-tabs-in-terminator-console-application-in-ubuntu