X resources

From Gentoo Wiki
Jump to:navigation Jump to:search
Resources

Also known as the ~/.Xresources file.

Introduction

X resources are configuration options for X applications such as the rxvt-unicode terminal emulator. They can also be used for setting the cursor theme. X resources can be set in ~/.Xresources.

While most display managers will automatically load this configuration file on startup, it is possible to load the configuration manually by running:

user $xrdb ~/.Xresources

The xrdb command is provided by the x11-apps/xrdb package.

Syntax

Configuration options in the ~/.Xresources file should respect the following component syntax:

name.Class.resource: value

Note
In many options the Class component is not used.

Examples of existing configuration options:

  • Xcursor.theme: redglass
  • xscreensaver.Dialog.background: #111111

Comments

Comments start with an exclamation mark or with double slashes. For example:

CODE
! This is a comment

// This is also a comment

/* Multiline comments
are supported
as well */

Wildcards

It is possible to use ? and * wildcards to apply a single rule to multiple configuration options. The ? matches any single component. The * matches zero or more components. For example:

*background: #000000 - Set the given value to all programs/classes which contain a component named background.

Constants

Constants can be defined in the following way:

#define name value (for example #define black #000000).

Includes

The main ~/.Xresources file can be composed of multiple sub-files (e.g. on a per-application basis). The includes can be defined as:

#include "file_name"

Example of including application sub-files:

FILE ~/.Xresources
#include ".Xresources.d/urxvt"
#include ".Xresources.d/xft"

See also

External resources