8

According to this answer, "it is the job of the terminal emulator to set the TERM environment variable".

Is there any way to change the TERM value used by Terminator? Right now it's xterm, but I need xterm-256color.

I use other terminal emulators (Gnome Terminator, tmux), so setting in my .bashrc would be messy at best.

jtpereyda
  • 2,065

3 Answers3

10

The way I do it is using a custom_command in ~/.config/terminator/config as follows:

...
[profiles]
  [[default]]
    ...
    custom_command = TERM=xterm-256color bash -l # Do not use 'terminator' here
    use_custom_command = True
    ...

This works like a charm i.e. for the 256-color skins for midnight commander. The -l option makes bash run as a login shell (which means that it will load settings from your .bash_profile). You can omit it if you prefer Terminator to launch bash as a non-login shell (so that it will load .bashrc instead).

6

There's an option called xterm in Terminator's configuration (see man terminator_config), which is supposed to set TERM. Due to a bug, it does not work, and TERM is always set to xterm. Terminator also sets a COLORTERM variable, to gnome-terminal, so you can use that to set TERM to xterm-256color (since gnome-terminal has no problem with that value:

[[ $COLORTERM = gnome-terminal ]] && TERM=xterm-256color

Or, what I use to avoid problems with screen/tmux:

[[ $COLORTERM = gnome-terminal && ! $TERM = screen-256color ]] && TERM=xterm-256color
muru
  • 197,895
  • 55
  • 485
  • 740
1

This is an untested idea:

  • Copy /usr/share/applications/terminator.desktop to ~/.local/share/applications
  • Edit the local .desktop copy so it sets TERM when starting terminator
Gunnar Hjalmarsson
  • 33,540
  • 3
  • 64
  • 94
  • 1
    Negative. While this works for setting environment variables in general, Terminator itself sets TERM anyway, so it gets overwritten. – jtpereyda Apr 10 '14 at 22:38
  • @dafrazzman: Hmm.. I thought it was not set at all. So, if terminator sets it to xterm while xterm-256color is needed, isn't it a bug in terminator? – Gunnar Hjalmarsson Apr 10 '14 at 23:10