I just spent most of an afternoon hunting down WTF is going on with the active vs other tabs visibility for the https://developer.gnome.org/gtk3/stable/GtkNotebook.html widget, with the default theme (Raleigh), for the same reason as the OP. I Finally got tired of having it near-impossible to see which tab is active at a glance. (There is a visible difference where the active tab connects to the border, but it's too subtle to be any use).
As far as I can tell, the default theme isn't supposed to look that way, and nobody ever fixed it since it was introduced. (or just fixed it for themselves and posted on a blog or something.) I reported it as https://bugzilla.gnome.org/show_bug.cgi?id=741185.
The fix is to put this in your .config/gtk-3.0/gtk.css:
.notebook tab:active {
background-color: darker(@bg_color);
}
The reason is that https://git.gnome.org/browse/gtk+/tree/gtk/theme/Raleigh/gtk-default.css has a bug. gtk-default.css is the Raleigh theme, which gets compiled in to gtk+, so it's used if there isn't a different default set somewhere.
...
notebook .active-page {
color: @selected_fg_color;
background-color: darker (@bg_color);
}
...
That css doesn't actually do anything. "active-page" is the string https://git.gnome.org/browse/gtk+/tree/gtk/gtknotebook.c checks, but it's not the name of the appropriate CSS element, or whatever the correct noun is. Also, the color property doesn't do anything for a notebook tab.
That code came from this commit:
https://git.gnome.org/browse/gtk+/commit/gtk/gtk-default.css?id=7cd3e7c81bf82bc51f2891e332575d1fbe3dde4e
And yes, it took me maybe 10 minutes to follow that file back through 3 renames or so. Yuck. (follow the link to the diffstat to find the rename, then -> parent commit -> tree, then browse to the file. Look at the log, repeat starting from the rename commit that introduced it.)
Links I found while looking into this:
https://askubuntu.com/questions/400979/how-to-change-gtk-notebook-tabs
http://www.gtkforums.com/viewtopic.php?f=3&t=988&p=72092&hilit=Styling+a+Notebook+with+gtk3+and+css#p72092
does some funky stuff, like put rounded corners on tabs. But didn't tell me what the right syntax was for affecting the active tab. Also, IDK why they use GtkNotebook { }
instead of .notebook { }
, since either one seems to work.
http://harts.net/reece/2013/02/26/highlighting-the-active-tab-in-gnome-terminal/
indicates that you can limit the fix to just gnome-terminal, by qualifying with TerminalWindow .notebook tab:active
https://developer.gnome.org/gtk3/stable/gtk-migrating-GtkStyleContext-css.html basics of gtk's subset of CSS. e.g. // comments don't work, only /* */
If you're tweaking your CSS, the easiest way to test it is to flip to another shell and run gedit file1 file2. (with files that exist, so it won't prompt you to save them). It comes up pretty fast, and you can close it again quickly.
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
This seems to work on my machine:
Please note, as soon as the processes executed by -e are done running, they will terminate. In this case, bash is loaded, runs whatever commands you pass to it, and immediately exists. I put in the read statements to wait for user input. This way those tabs won't close until you press a key, just so you can see it in this example. Without them, it would look as if only two tabs opened, because the other two would execute and close too quickly.