Why whould xterm behave differently than x-terminal-emulator when it points to the same executable

alternativesx-resourcesxterm

lrwxrwxrwx 1 root root 14 Apr 19 14:36 /etc/alternatives/x-terminal-emulator -> /usr/bin/xterm

Running it using these 2 calls:

  • /usr/bin/xterm
  • /etc/alternatives/x-terminal-emulator

First starts with black background and other starts with white. What are possible reasons that is it not the same configuration? How to debug it?

Best Answer

An X resource name consists of a list of components separated by periods. Each component can be either an instance name or a class name. Instances identify a specific component (e.g. the third button on the top row) while classes identify a type of components (e.g. all buttons in the main window). By convention, class names begin with an uppercase letter and instance names begin with a lowercase letter. See Doubts about creating a .Xresources file. or the read the X documentation for more details.

The first component of a resource name is the application. At this level, the class name some application name chosen by the author of the application; for Xterm, that's XTerm (by convention, for applications called X Foo, the second letter is also capitalized). The instance name is, by default, the name of the executable file used to launch the application. Conventional X applications support command line options -name and -class to override these default values.

When you start Xterm through a symbolic link, this changes the name of the executable file (it's the name you use that matters, or more precisely the name that the calling processes passes in argument 0). Thus the instance name (used, among other less visible things, for resource lookup) changes. If you want your settings to apply regardless of the name used to invoke Xterm, define your resources (in ~/.Xresources or whatever file you chose to put them) through the class, e.g.

XTerm.VT100.background:        Black

instead of through the instance (xterm.VT100.background).

Related Question