Under 11.4 (but not 11.3), the TERM setting in xfce terminal is ignored. In fact, it is correctly set by Xfce Terminal but overwritten by vte at a later point. See the picture below and a detailed description of the bug here: https://bugs.launchpad.net/xfce4-terminal/+bug/778801. It doesn't just affect openSUSE 11.4 and Ubuntu 11.04, but any Linux distro since vte 0.26. Here's the bug report for ArchLinux: https://bugs.archlinux.org/task/21007.


As it is unlikely to get fixed anytime soon, I found a simple workaround. Fortunately, xfce Terminal sets the variable COLORTERM to Terminal in the environment, and this variable is untouched by vte. We can simply redefine TERM, either system-wide in /etc/bash.bashrc.local and /etc/csh.cshrc.local or in user's ~/.bashrc and ~/.cshrc. Since gnome-terminal and other terminal emulators set this variable too, we could use something like in the code below to redefine TERM based on the value of COLORTERM for the different terminal emulators. The value you assign to TERM (in this example xterm-color) is up to you, but should have a valid terminfo entry and be supported by the programs used in the terminal.

  • for bash/sh:

    Code:
    # setting TERM based on COLORTERM
    case $COLORTERM in
    Terminal) export TERM=xterm-color ;;         # this is XFCE Terminal
    gnome-terminal) export TERM=xterm-color ;;   # this is gnome-terminal
    wterm-xpm) export TERM=xterm ;;              # this is wterm
    Eterm) export TERM=Eterm ;;                  # this is Eterm
    1) export TERM=xterm-color ;;                # this is lxterminal, konsole, yakuake, uxterm, Mac OSX terminal, putty ...
    # rxvt) ;;                                   # xterm, aterm, rxvt-unicode
    esac
  • for csh:

    Code:
    # setting TERM based on COLOTERM
    switch ( $COLORTERM )
    case Terminal:                               # this is XFCE Terminal
    	setenv TERM xterm       ; breaksw   
    case gnome-terminal:                         # this is gnome-terminal
    	setenv TERM xterm-color ; breaksw   
    case wterm-xpm:                              # this is wterm
    	setenv TERM xterm-color ; breaksw   
    case Eterm:                                  # this is Eterm
    	setenv TERM Eterm       ; breaksw   
    case 1:                                      # this is lxterminal, konsole, yakuake, uxterm, Mac OSX terminal, putty ...
    	setenv TERM xterm-color ; breaksw   
    # case rxvt:                      breaksw    # xterm, aterm, rxvt-unicode
    endsw


As you certainly noticed in the code above, Terminal (Xfce), gnome-terminal, wterm and Eterm each set COLORTERM to a different specific value, while most other color compatible terminal emulators (such as lxterminal, konsole, yakuake, uxterm, as well as Mac OSX terminal and putty) set the value 1. xterm, aterm, rxvt-unicode and probably some others set COLORTERM to rxvt. However those use different values for TERM, that can also be changed through the command line option -tn or the resource termName. Thus I excluded 'rxvt' from the list.