How to set gnome-terminal tab title. Permanently…

I’ve been looking for this a few times without success. There are some nasty proposals with setting PS1 variable or other tricks with .bashrc mods. Weak and doesn’t actually work.I needed a way to make a bash script that opens several tabs with fixed t…

I’ve been looking for this a few times without success. There are some nasty proposals with setting PS1 variable or other tricks with .bashrc mods. Weak and doesn’t actually work.
I needed a way to make a bash script that opens several tabs with fixed titles and with fixed start directories and with already started programs (for example tail/less of log files). Or solutions are very complicated.

There’s a simple way.

There’s a nice option for gnome-terminal -t “Tab title” which allows you to set a title for a tab. But in default profile (a switchable terminal behavior configuration) any program or bash prompt can change tab’s title. So actually setting tab title doesn’t work permanently.

A good solution is to create a new profile (let’s call it “NoTitleChange”) with options set to not to allow tab change. To do this, in gnome-terminal go to Edit->profiles… click New, apply new name. Then in tab Title and Command from drop box (When commands set own title…) choose Keep initial title.


Now you can invoke

gnome-terminal –tab-with-profile=NoTitileChange -t “My Permanent title”

and nothing will change the tab’s title.
You can play with these and other options to create many tabs in one window.
gnome-terminal –tab-with-profile=NoTitleChange -t “PERMANENT” –tab-with-profile=NoTitleChange -t “TABS ARE”  –tab-with-profile=NoTitleChange -t “AWESOME”
I’m using these other options

-e, –command=STRING
                 Execute the argument to this option inside the terminal.

–working-directory=DIRNAME
                 Set the terminal’s working directory to DIRNAME.

–geometry=GEOMETRY
                 X geometry specification (see “X” man page), can be specified once per window to be opened.

For example

gnome-terminal –tab-with-profile=NoTitleChange -t “src” –working-directory=/opt/workspace/play/mnp/repo/console_gxt2/mnpc  –tab-with-profile=NoTitleChange -t “DevMode” –working-directory=/opt/workspace/play/mnp/repo/console_gxt2/mnpc –command=”mvn initialize exec:exec -Pdevel”

Now you can create start script that opens proper working dirs (with source code for example) and with server logs open. And you’re ready to go!
You May Also Like

Simple HBase ORM

When dealing with data stored in HBase, you are quick to come to a conclusion, that it is extremaly inconvenient to reach to it via HBase native API. It is very verbose and you always need to convert between bytes and simple types - a pain. While I wa...When dealing with data stored in HBase, you are quick to come to a conclusion, that it is extremaly inconvenient to reach to it via HBase native API. It is very verbose and you always need to convert between bytes and simple types - a pain. While I wa...