“Xterm” or “xterm” in configuration file

x-resourcesxterm

After starting to use Arch I switched to xterm and urxvt terminal and enjoyed the flexibility of them (esp. scaleHeight resource). However, I don't understand why sometimes configs work with Xterm and sometimes with xterm or XTerm (lower vs upper case x and t).

For example, I have this odd config that is working on Ubuntu:

XTerm*faceName: terminus
XTerm*faceSize: 11
XTerm*saveLines: 16384
XTerm*loginShell: true
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*VT100.geometry: 100x80    ! <------ this line would not work with "Xterm" or "XTerm"
XTerm*scaleHeight: 1.3          ! <----- but all others work with "XTerm"

However, my Arch box runs on "xterm" fine. The same is true for URxvt terminal: I can't simply port my Arch .Xresources to Ubuntu14 work box because parts of it stop working, and I get different setups after running:

xrdb -merge .Xresources

X.org on xterm did not have any examples (searching for "xterm*" did not return anything on that page). I see examples with Xterm, xterm and XTerm online… It baffles me that the config above works since it is syntactically off. Why is this the case? Does it maybe have something to do with new or old resources in X? Thanks!

xterm on ubuntu is Xterm(297). I don't have access to my Arch box at the moment, but it would be pretty up-to-date. I don't know how to tell Xterm version from Arch's repos, but maybe this: https://www.archlinux.org/packages/extra/i686/xterm/
So, if that link is right, then yes, I am running different Xterm versions.

I tried upgrading xterm, but it is still 297.

apt-get update && apt-get install --only-upgrade xterm

I can't do it now, but I might try to recompile the latest version to see if the issue is there.

Following the suggestions by ILMostro_7 below I tried XTerm.vt100.geometry, which still did not work. This is Xterm (297) on Ubuntu14. So basically, . or * it seems to only work with little xt.


Result of appres XTerm xterm | grep geometry thanks to Gilles. I did not think to look up what exactly xrdb -merge does which resulted in this mess. So my guess is that one of these takes precedence over everything else?

xterm.VT100.geometry:   100x100
xterm*VT100.geometry:   100x80
xterm*VT100*geometry:   50x50
xterm.vt100.geometry:   160x40
xterm*vt100.geometry:   100x20
xterm.geometry: 5x5
xterm*geometry: 100x20
XTerm.VT100.geometry:   100x100
XTerm*VT100.geometry:   50x50
XTerm*VT100*geometry:   20x10
XTerm.vt100.geometry:   100x5
XTerm*vt100.geometry:   40x40
XTerm*geometry: 50x50

In fact it looks like xterm.vt100.geometry: 160x40 takes precedence over other ones since that the instance I keep getting. Also, I somehow managed to completely screw up Xterm menues (Ctrl+mouse click) – they show up as a small yellow line. Hehe

Best Answer

X11 resources have a name which consists of a series of components separated by a dot, such as xterm.vt100.geometry. The first component is the name of the application, the second component is a widget in that application, and the last component is a property of the widget. Widgets can be nested, so there can be more than three components, or just two for a property of the application.

Specifications of X resources can apply to a single resource or to a set of resources matching a pattern. There are two ways to make a specification apply to multiple resources.

  • You can use a class name instead of an instance name for any component. Conventionally, instance names start with a lowercase letter while class names start with a capital letter.

    • At the application level, the class name is usually fixed for a given application, typically to the capitalized application name, and sometimes other letters are also in uppercase, e.g. XTerm, XCalc, GV, NetHack, ... Applications using the X toolkit support an option -class to set the class name, as well -name to set the instance name (which defaults to the base name of the executable). For example XTerm.vt100.geometry sets a value of the geometry property for the vt100 widget of any instance of the XTerm class; it applies to xterm -name foo but not to xterm -class Foo.
    • At the widget level, there can be multiple widgets with the same class, for example multiple buttons in the same window. Xterm has a single widget of class VT100, called vt100, which is the terminal emulator part that covers the whole window. Other widgets include the menus mainMenu, fontMenu and vtMenu of class SimpleMenu.
  • There are wildcards: ? means “any widget”, and * means “any widget sequence”. For example xterm*background defines a background for absolutely everything inside the Xterm window.

You can explore the resource tree of an application that supports the editres protocol with editres. Few applications support this protocol, but Xterm is one of them.

It's possible for a given resource to be matched by multiple patterns. In this case, precedence rules apply. See the manual for the full rules.

In your case, it's likely that there's another entry somewhere that is a closer match for xterm.vt100.geometry than xterm*VT100.geometry, and that match is overriding your setting. The others have no other setting so whatever you do wins.

Related Question