I think it is not possible. The relevant script is /etc/gdm/Xsession. There quite at the top you'll find
# First read /etc/profile and .profile
test -f /etc/profile && . /etc/profile
test -f "$HOME/.profile" && . "$HOME/.profile"
and after that (and sourcing other scripts, loading X resources etc) the desktop environment is started, inheriting the values of .profile just loaded. As there is no way to change the environment of running processes (if the process has no special functionality to import changed environment, but this is nothing you commonly find), you seem to be out of luck.
Use the -t
option. (see gnome-terminal --help-terminal-options
)
gnome-terminal \
--tab -t "notes" --working-directory=$HOME/notes \
--tab -t "puppet" --working-directory=$HOME/puppet \
--tab -t "beamish" --profile=root-beamish \
--tab -t "odyssey" --profile=odyssey \
--tab -t "root" --profile=root
-------- updated at 2011-11-15 22:00:00 --------
So... that worked for me on Solaris 11 Express, with gnome-terminal 2.30.2.
Since then, I've been able to test it on Ubuntu 11.04 (Natty), which uses 2.32.1, and found exactly the same behavior as you.
In the case of Ubuntu, I was able to track it to the ubuntu .bashrc
file. In particular, the section that looks like:
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
In this case, the PS1 variable is being expanded for terminal types matching xterm*
and rxvt*
.
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
specifically the part between PS1="\[\e]0;
and \a\]
. Those get turned into the window title.
Once I commented out that whole case
statement, the behavior of gnome-terminal with the -t
option worked as expected. I'll see if I can find a CentOS 6 box to test this with, too.
-------- updated at 2017-11-1 09:38:00 --------
So it looks like more recent versions of Gnome-Terminal have made away with some useful features, like the simple -t
option to set terminal titles.
It is still possible to set terminal titles at runtime, it's just ugly as hell now. You can use printf
or echo
in the command to effect a title.
For example:
To start a terminal window with 1 tab, titled 'My Fancy Title' using printf
:
gnome-terminal --tab -e 'bash -c "printf \"\e]2;My Fancy Title\a\"; bash -i"'
To start a terminal window with 2 tabs, one running top, and one with a title, using echo
:
gnome-terminal \
--tab -e 'bash -c "echo -ne \"\033]0;my tab running top\007\"; top"' \
--tab -e 'bash -c "echo -ne \"\033]0;My Fancy Title\007\"; bash -i"'
This does at least offer an option for setting the terminal title at runtime.
See this post for an option to put a simple function in your ~/.bashrc
to allow for setting and resetting the title at will.
Best Answer
Looking over the way gome-terminal works, it looks like you need to do a couple things:
It appears as though the config-file saving is really for session saving (i.e. it stores all your open windows), and it does not save any command-line provided titles, so you can get what you want via a command-line + profile, but not via the config file.
I've taken the liberty of reporting the lack of command-line option saving in the save-config switch against G-T at https://bugzilla.gnome.org/show_bug.cgi?id=645207