xrdb
Load X resource database
TLDR
Start xrdb in interactive mode
Load values (e.g. style rules) from a resource file
Query the resource database and print currently set values
SYNOPSIS
xrdb [options] [filename]
PARAMETERS
-query or -q
Prints the current contents of the RESOURCE_MANAGER property.
-load
Loads the contents of the specified file or standard input into the RESOURCE_MANAGER property. This is the default action if no explicit action is given and a file is provided.
-merge or -m
Merges the contents of the specified file or standard input with the existing resources. This is the default behavior when loading.
-edit or -e
Allows editing of the current RESOURCE_MANAGER property using an external editor defined by the EDITOR environment variable.
-remove or -r
Removes the RESOURCE_MANAGER property from the server.
-override or -ov
Overrides existing resources with the new ones.
-nocpp
Disables processing the input through the C preprocessor.
-cpp program
Specifies an alternative C preprocessor program to use.
-silent or -s
Suppresses warning and error messages.
-backup suffix
Creates a backup file with the given suffix before modifying the resource database file.
-display display
Specifies the X server to connect to.
-all
Operates on all screens of the display.
DESCRIPTION
xrdb is a command-line utility used to manage the X server's resource database. This database, typically stored in the RESOURCE_MANAGER property on the root window of screen 0, holds user-specific configuration settings for X applications. Applications often query this database to determine their appearance, behavior, and default values.
Common uses include loading user preferences from files like ~/.Xresources or ~/.Xdefaults during X session startup. By default, xrdb merges the contents of the specified file (or standard input) with the existing resources, allowing for flexible configuration updates. It can also query, remove, or edit the current resource database.
The resource file often uses a format similar to X application default files and can include C preprocessor directives, enabling conditional configurations based on various factors.
CAVEATS
The RESOURCE_MANAGER property is typically managed per-display, and applications usually read it only once at startup. Changes made by xrdb may not affect already running applications until they are restarted.
Modern desktop environments often provide their own configuration systems that might override or coexist with xrdb settings, potentially leading to unexpected behavior if not managed carefully.
<B>RESOURCE FILE FORMAT</B>
The resource file typically consists of lines defining resources in the format: Application.ResourceName: value. It supports C preprocessor directives like #include, #define, and conditional compilation (#ifdef, #ifndef), allowing for highly flexible and environment-dependent configurations.
<B>INTERACTION WITH X CLIENT LIBRARIES</B>
X applications using the X Toolkit (Xt) or Xlib functions like XGetDefault automatically query the RESOURCE_MANAGER property (or .Xdefaults file as a fallback) to retrieve configuration values. This central mechanism ensures consistent application behavior across different sessions and applications if they adhere to the resource manager standard.
HISTORY
xrdb is a fundamental utility from the early days of the X Window System. It was developed as part of the X11 distribution to provide a standardized way for users to define and load application-specific settings, moving away from individual application configuration files. Its design reflects the client-server architecture of X, allowing resources to be stored centrally on the X server. It has remained a stable and essential component for managing X resources over decades.