First written sometime in 2006.
When I say xterm
, I'm talking about Thomas E. Dickey's xterm,
which came from XFree86
.
Although every free desktop ships its own terminal emulator,
I always install xterm
on my systems.
I keep a set of customizations in my ~/.Xresources
file to
make xterm
look and feel a lot better than its default settings.
Here they are, in easily digestible (and copy-paste-able) pieces:
First, pick a nice font. I quite like proggy fonts. Also good are Terminus and Triskweline.
xterm*font: terminus-12
(Note: the above is just an example. On a Debian-like system, simply
apt-get install xfonts-terminus
.
On another system, download the font you
want to use, add it to your X fontpath, and work out its full name, usually
using xlsfonts
. Don't just add the above line, not install
the font, and then wonder why it isn't working)
Next, I like all my terminals being login shells. Ones that honor
.profile
and generally initialize the shell environment the way I expect.
I have no idea why the default is to not do this.
xterm*loginShell: true
Next, size: I'm very particular about having an 80x50 terminal. 80 columns is not just a good idea, it's the law:
xterm*vt100*geometry: 80x50
Note the vt100
above. If you write out this line without it,
the geometry setting will affect things other than the size of the
xterm
. Like, for example, the Ctrl+Click menu will be 80 pixels
wide and 50 pixels tall, rendering it entirely unusable. Thanks to Alex Peters for figuring
this out and telling me about it.
Next, I like having lots of scrollback:
xterm*saveLines: 2000
Note that I don't turn on any scrollbars. You can scroll up and down by
using Shift+PgUp and Shift+PgDn, respectively. Sun Microsystems always screw
this up for me - they switch the meanings of PgUp and Shift+PgUp, so regular
PgUp becomes scrolling and you have to "escape" it with a Shift to get the
PgUp sent to the underlying application. They even make the
gnome-terminal
that comes with the Sun Java Desktop behave like
this.
Next, I like being able to double-click to select a word. The definition of
a "word" depends on the character class resource. For a complete
explanation, look at the CHARACTER CLASSES section in the
xterm
manpage. Here's what I use:
xterm*charClass: 33:48,35:48,37:48,43:48,45-47:48,64:48,95:48,126:48
Some systems get confused about xterm
's TERM type. It's
xterm-color
. If you're using an outdated OS, like Solaris,
you'll need to install the xterm-color
terminfo file into the
appropriate place. (/usr/share/lib/terminfo/x/xterm-color
on
Solaris) Get it right:
xterm*termName: xterm-color
If Alt+F sends \346
and you need ^[f
, add the
following line. I've seen this problem on modern Linux systems.
xterm*eightBitInput: false
Now the fun bit: I actually really like the DOS-box colors. These are taken from a screen capture:
xterm*foreground: rgb:a8/a8/a8 xterm*background: rgb:00/00/00 xterm*color0: rgb:00/00/00 xterm*color1: rgb:a8/00/00 xterm*color2: rgb:00/a8/00 xterm*color3: rgb:a8/54/00 xterm*color4: rgb:00/00/a8 xterm*color5: rgb:a8/00/a8 xterm*color6: rgb:00/a8/a8 xterm*color7: rgb:a8/a8/a8 xterm*color8: rgb:54/54/54 xterm*color9: rgb:fc/54/54 xterm*color10: rgb:54/fc/54 xterm*color11: rgb:fc/fc/54 xterm*color12: rgb:54/54/fc xterm*color13: rgb:fc/54/fc xterm*color14: rgb:54/fc/fc xterm*color15: rgb:fc/fc/fc
Note that foreground is lightgray (color7) and background is black (color0). Dark text on a light background is evil and wrong.
Next, bold text looks really terrible. I prefer the bold attribute to make
the text bright, like it did in DOS, instead of making the font fat and
illegible. To do this, disable boldMode
:
xterm*boldMode: false
Sometimes this isn't enough and you still get unreadable text.
You can work around it by setting xterm*boldFont
to
the same value as xterm*font
above. I've seen this
problem on modern Linux systems.
boldMode
makes color+bold = lightcolor, but bold
foreground (color7) stays color7. As in, bold now has no effect on
uncolored text. I want lightgray+bold = white, so I add:
xterm*colorBDMode: true xterm*colorBD: rgb:fc/fc/fc
And that's it.
The whole thing in one copy-paste-friendly chunk
xterm*font: terminus-12 xterm*boldFont: terminus-12 xterm*loginShell: true xterm*vt100*geometry: 80x50 xterm*saveLines: 2000 xterm*charClass: 33:48,35:48,37:48,43:48,45-47:48,64:48,95:48,126:48 xterm*termName: xterm-color xterm*eightBitInput: false xterm*foreground: rgb:a8/a8/a8 xterm*background: rgb:00/00/00 xterm*color0: rgb:00/00/00 xterm*color1: rgb:a8/00/00 xterm*color2: rgb:00/a8/00 xterm*color3: rgb:a8/54/00 xterm*color4: rgb:00/00/a8 xterm*color5: rgb:a8/00/a8 xterm*color6: rgb:00/a8/a8 xterm*color7: rgb:a8/a8/a8 xterm*color8: rgb:54/54/54 xterm*color9: rgb:fc/54/54 xterm*color10: rgb:54/fc/54 xterm*color11: rgb:fc/fc/54 xterm*color12: rgb:54/54/fc xterm*color13: rgb:fc/54/fc xterm*color14: rgb:54/fc/fc xterm*color15: rgb:fc/fc/fc xterm*boldMode: false xterm*colorBDMode: true xterm*colorBD: rgb:fc/fc/fc
Rant: DOS
Yes, yes, DOS is terrible, blah blah, whatever. I grew up on DOS and it had an awesome default color scheme and lots of cool drawing characters that very talented people could use to make some awesome ANSI art.
Obviously, I much prefer the Unix environment, but one of the things that
always irked me about it (before I wasted all this time figuring out how
xterm
and terminfo
and curses
play
together) is that it just looked bad.
What I'm trying to say is: I think that making an xterm
look
like a DOS box should not carry the stigma of DOS being DOS. A default
xterm
looks bad. A default DOS box looks much better.
Rant: How not to configure xterm
At University, we had a very cool shared Unix environment, like back in the good
old days. Something I used to see very often, which disturbed me, was people
configuring their xterm
s through their window manager
configuration. As in, they would have
a menu entry for starting a terminal, and it'd run xterm
followed
by several wrapped lines of commandline arguments to tweak all the different
settings they wanted.
This is the wrong way to do it.
The default resources for an xterm
belong in the same place as
the default resources for all your other X applications: in a file called
.Xresources
The benefits of doing it right:
- You don't need to restart your window manager every time you change your
xterm
defaults. Just open a newxterm
. - All
xterm
s look the same, regardless of how they were started. Sometimes I want to typexterm
into a runningxterm
. - Setting resources through
.Xresources
is much saner than doing it with a hideously long commandline. - If you change one stupidly long commandline, you don't have to manually
update a bunch of other stupidly long commandlines for consistency. I don't
think I've ever seen a WM menu with only one flavor of
xterm
in it.
The Debian Xsession(5)
manpage says that
.Xdefaults
is a hangover from X10 and X11R1, and that it
should be spelled .Xresources
. On their system, you need
to use xrdb
to [re]load the resources file:
xrdb -merge ~/.Xresources
Rant: Desktop Environments
Konsole
and gnome-terminal
suck.
Matt Dillon wrote:
gnome is a good test. The gnome-terminal program is a medium-sized cpu hog (it uses four times the cpu that the pine program running under it uses)
And how the hell do you get a gnome-terminal
to have a default
geometry of 80x50 when it starts!?
Rant: 80 columns or bust
For a while, I spent some time in a 100x50 terminal because I had decided that only using 80 columns was anachronistic and unnecessarily limiting.
Later, after I'd come to my fucking senses, I had to work on some code that I had written to a width of 100 columns and I really badly wanted to go back in time and kick my own ass!