XTerm – Old – Reliable – Configurable!

Published on November 24, 2022 at 11:13 pm by LEW

Introduction

In this post I will be looking at configuring XTerm, a terminal emulator that is very light weight (no fancy features present in other terminal emulators). If your terminal needs are not overly heavy, it could be just want you need on your light Linux installation.

One of the problems many have with XTerm is that it is not overly obvious how to do any temporary configuration. And if you want to do any permanent configuration changes, you will have to jump into the wonderful world of Xresources.

I am taking a short break from my current JWM series to do this post. It does apply as I am using XTerm with my light weight JWM install on Arch Linux. So I felt the diversion was worth it. I do want to make one note, if you are following the JWM on Arch posts, JWM group settings will override some Xresource settings that I will be covering in this article. Specifically things like size and placement.

XTerm On the Fly Configuration

Opening a XTerm instance one will find something fairly plane and vanilla. No menus, tabs, or scroll bars of any sort. If you only use the terminal occasionally, this might be more than adequate.

Plain XTerm

A lot of the controls are though keyboard shortcuts. For example, since there are no scroll bars, scroll up and down is accomplished by Shift – Page up and Shift – Page Down.

There is some temporary configuration that can be done. While Xterm has no menu bar, it does have menus. Simply hover over the terminal window (not in the title bar), then press and hold the control key. While holding the control key, left, center and right click to see the Main options, VT options, and Font Options menus.

Go ahead and test some of the menu options. If you get stuck, simply close and reopen the terminal. You will notice that when you close and reopen the terminal, all theses menu options go away and you are back to the plane terminal display.

Which Brings us to our next subject…

XTerm Permanent Configuration Changes

This is where the Xresources come into the picture. Once you use Xresources a couple of times, you will find it is not all that hard.

First we need a place to store them. Generally this will be in a default file at your home directory root called “.Xresources”. So open your favorite text editor and enter the following, then save the file at the root of your home directory (note do not add an extension). Obviously you can make the comment whatever you want it to be.

! My Xresources file (by the way this is a comment line)

Next we need to verify if the “xrdb” (X Resources Data Base) program is on your computer. It is a program that merges and updates Xresources. Type the following to see if you get a version number back.

xrdb -v

If not present you will need to install it using your distributions package management system. On Arch is its own package, “xorg-xrdb”. On Debian systems it should be included in “X11-xerver-utils”. For other distros you will need to search the package repository list.

Once it is installed, you will need to use the following command to merge your .Xresorces file with the Xresoruces database.

xrdb -merge ~/.Xresoruces

Note that on some systems this command may be run upon starting X. For example, if you are following the series JWM on Arch, you will find that the command exists  within the “.Xinitrc” file that is run when the “startx” command is issued, thus merging Xrsources automatically on start of X windows.

In the next section, I will present my Xresources for XTerm.

Xterm Local Configurations

To simplify this post, I will simply place my Xresoruces configuration file in line. Note that I will be using the three hex digit codes as opposed to the six hex digit or color names (you can use any of three systems and even intermingle them), same as I did in the JWM posts.

For the most part everything should be self explanatory. I will add some notes below the file list.

! My Local Xresources Configuration

!XTerm Operational Parameters

XTerm*loginShell: true
XTerm*savelines: 1024
XTerm*termName: xterm-color
XTerm*eightbitInput: false

! XTerm Color Configuration

XTerm*Background: #111
XTerm*Foreground: #eee
XTerm*cursorColor: #0f0
XTerm*pointerColor: #ff0
XTerm*color0: #000
XTerm*color1: #b00
XTerm*color2: #0b0
XTerm*color3: #b50
XTerm*color4: #00b
XTerm*color5: #b0b
XTerm*color6: #0bb
XTerm*color7: #bbb
XTerm*color8: #555
XTerm*color9: #f55
XTerm*color10: #5f5
XTerm*color11: #ff5
XTerm*color12: #55f
XTerm*color13: #f5f
XTerm*color14: #5ff
XTerm*color15: #fff

! XTerm Scroll Bars

XTerm*ScrollBar: true
XTerm*rightScrollBar: true
XTerm*ScrollBar.width: 8

! XTerm Fonts

XTerm*renderFont: true
XTerm*faceName: “DejaVu Sans Mono”
XTerm*faceSize: 12

loginShell: This should force some consistency, making XTerm run the same as if you had logged in to a terminal.

savelines: The amount of previous activity that is maintained. The default is 1024.

eightbitInput: This will disable some older style ASCII inputs from occurring. Generally not a problem unless you are using some unusual characters.

XTerm Color Configuration: This is a 16 color palette (18 if we include foreground and background). You can set your own colors for using XTerm in color mode.

I have also turned on the scroll bar and placed it on the right side (defaults to left side), and made it 8 pixels wide.

I am also using rendered fonts (like true type) instead of bit-mapped fonts.

Conclusion

XTerm is light and fast, and with a little work, the look can be improved considerably. If you are not a die hard terminal user (those people know who they are), Xterm may be all you need to meet your terminal needs.

When you have the time, take a look at the XTerm man page. It is a bit long, but will show you just how configurable XTerm is.

 

Add New Comment

Your email address will not be published. Required fields are marked *