![]() But you can also just do export TERM=gnome-terminal. If you want to override this, many terminals will offer some way of configuring the behavior. Most terminals will opt for more compatibility, and thus choose to advertise themselves as xterm. So you have a tradeoff, get more features, or have more compatibility. The downside to lying about your terminal type is that the terminal might actually support a lot more than xterm does (for example, many new terminals support 256 colors, while older terminals only supported 16). So by gnome terminal saying it's an xterm, it's more likely to have a definition in the terminfo library. Xterm is a very basic terminal that has been around since the dawn of X11, and thus most terminal emulators support what it supports. So your gnome terminal is saying " I'm xterm". The way your terminal gets around this is by lying about who it is. When your application goes to look up how to do something, it will fail because the terminal isn't known. Now let's say you have some shiny new terminal emulator that was just released, and the system's terminfo library doesn't have a definition for it yet. This will get the setf terminfo capability and pass it a parameter of 4, which is the color you want. ![]() You can try this yourself by doing tput setf 4 echo hi. Then it just takes those bytes and prints them out. It basically makes a call to the terminfo library that says " give me the sequence of bytes I have to send for red text for the xterm terminal". So let's say you have a program that wants to display red text. On most systems this is in /usr/share/terminfo (there's also termcap, but it's legacy not used much any more). The way this works is that the system keeps a library of known terminals and their capabilities. The $TERM variable is for use by applications to take advantage of capabilities of that terminal.įor example, if a program wants to display colored text, it must first find out if the terminal you're using supports colored text, and then if it does, how to do colored text.
0 Comments
Leave a Reply. |