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
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!
No comments:
Post a Comment