In the X Window System, the X resources are parameters of computer programs such as the name of the font used in the buttons, the background color of menus, etc. They are used in conjunction with or as an alternative to command line parameters and configuration files.
Xresources and Xdefaults are user-level configuration dotfiles, typically located at ~/.Xresources and ~/.Xdefaults. They can be used to set X resources, which are configuration parameters for X client applications.
They can do many operations, including:
- defining terminal colours
- configuring terminal preferences
- setting DPI, antialiasing, hinting and other X font settings
- changing the Xcursor theme
- theming xscreensaver
- altering preferences on low-level X applications (xclock (xorg-xclock), xpdf, rxvt-unicode, etc.)
~/.Xresources does not exist by default. Being a plain-text file, you can create and edit it with the text editor of your choice. Once present, it will be parsed by the
xrdb (Xorg resource database) program automatically provided that you either:
- are using a Display Manager to log into X. Most DM will autoload the
~/.Xresourcesfile on login.
- if you are using
startx, you have to edit your
The resources will be stored in the X server so the file does not need to be read every time an app is started.
To reread your .Xresources file, and throw away your old resources:
To reread your .Xresources file, and keep your old resources:
xrdb -merge ~/.Xresources
.Xresourcesis just a naming convention, xrdb can load any file. If you use xrdb manually, you can put such a file anywhere you want (for example,
- If you background the execution of xrdb in a chain of commands in
~/.xinitrc, the programs launched in the same chain might not be able to make use of it, so it is recommended to never background the xrdb command within
- Resources loaded with xrdb are also accessible to remote X11 clients (such as those forwarded over SSH).
- The older (deprecated)
~/.Xdefaultsfile is read every time you start an X11 program such as
xterm, but only if
xrdbhas not ever been used in the current X session.
Adding to xinitrc
If you do not use a desktop environment, you probably need to add the following line to your
[[ -f ~/.Xresources ]] && xrdb -merge ~/.Xresources
To see the default settings for your installed X11 apps, look in
Detailed information on program specific resources is usually provided in the man page for that app. Xterms manpage is a good example, containing a list of resources and the default value.
To see the current loaded resources:
xrdb -query -all
Warning: Color name “********” is not defined
I got this problem when I defined color scheme commands in terminal. It’s solved by rename
~/.XResources. I don’t know why but it works.