Start xterm instance with different configurations

configurationx-resourcesx11xterm

It's there a way to start instances of xterm using different configuration files. Ex: xterm -load .Xresources-1, xterm -load .Xresources-1

Using xrdb -load ~/.Xdefaults changes the configs globaly which I try to avoid.

Best Answer

That's usually done by changing the instance name, which by default is the name of the program which is run, but can be overridden using the -name option. (If you make a symbolic link to a program and run that link, that's a quick way of renaming a program as well).

If you have a resource file with settings like

xterm*font: fixed

the instance is the xterm at the beginning of the line.

You can also change the class name (which you commonly see as XTerm, also at the beginning of the resource lines). The uxterm script uses the -class option to override this to change settings to make xterm work consistently in UTF-8 mode.

If you have different class names, then you can use the app-defaults search mechanism to support different resource files. I set the environment variable XAPPLRESDIR to my own directory, and have locally-customized resource files (each named for a class). That is documented in X(7):

application-specific files
Directories named by the environment variable XUSERFILESEARCHPATH or the environment variable XAPPLRESDIR (which names a single directory and should end with a '/' on POSIX systems), plus directories in a standard place (usually under /tmp/Xorg-KEM/lib/X11/, but this can be overridden with the XFILESEARCHPATH environment variable) are searched for for application-specific resources. For example, application default resources are usually kept in /tmp/Xorg-KEM/lib/X11/app-defaults/. See the X Toolkit Intrinsics - C Language Interface manual for details.

Related Question