XRDB(1)

๐Ÿ“ฆ
version 7.7+11build1 ยท 4 versions
, in alpine 3.24, centos-stream 10, debian trixie, fedora 43, fedora 44, nixos 26.05, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

๐Ÿ’– xrdb(1) โœจ General Commands Manual โœจ

๐ŸŽ€ NAME

xrdb โ€” X server resource database utility ๐Ÿงš

๐Ÿ“œ SYNOPSIS

xrdb [-option ...] [filename]

๐Ÿ’… DESCRIPTION

okay so xrdb is how you get or set the contents of the RESOURCE_MANAGER property on the root window of screen 0, or the SCREEN_RESOURCES property on the root window of any or all screens, or everything combined ๐Ÿฆ‹ You'd normally run this from your X startup file, bestie.

Most X clients look at the RESOURCE_MANAGER and SCREEN_RESOURCES properties to find your preferences about color, fonts, and so on ๐ŸŒˆ Keeping that info in the server (where every client can see it) instead of on disk is literally the fix for the old versions of X that made you maintain defaults files on every machine you might use ๐Ÿ˜ญ It also lets you change defaults on the fly without editing any files. iconic, honestly ๐Ÿ‘‘

The RESOURCE_MANAGER property is for resources that apply to all screens of the display. The SCREEN_RESOURCES property on each screen holds extra (or overriding) resources for that one screen. (When there's only one screen, SCREEN_RESOURCES is normally not used, and everything just goes into RESOURCE_MANAGER ๐Ÿ’œ)

The file you give as filename (or standard input if you pass - or no filename at all) can get run through the C preprocessor, and it's optional ๐Ÿซถ The symbols that get defined depend on what the server you're using can do. Here's the full list:

  • SERVERHOST=hostname โ€” the hostname part of the display you're connected to ๐Ÿ’–
  • SRVR_name โ€” the SERVERHOST hostname turned into a legal identifier. So "my-dpy.lcs.mit.edu" becomes SRVR_my_dpy_lcs_mit_edu โœจ
  • HOST=hostname โ€” same as SERVERHOST ๐Ÿ“
  • DISPLAY_NUM=num โ€” the number of the display on the server host ๐ŸŒธ
  • CLIENTHOST=hostname โ€” the name of the host where xrdb is running ๐Ÿ’œ
  • CLNT_name โ€” the CLIENTHOST hostname turned into a legal identifier. So "expo.lcs.mit.edu" becomes CLNT_expo_lcs_mit_edu ๐Ÿฆ‹
  • RELEASE=num โ€” the vendor release number for the server. How this number gets read depends on VENDOR ๐Ÿ”ฅ
  • REVISION=num โ€” the X protocol minor version the server supports (currently 0) ๐ŸŒˆ
  • VERSION=num โ€” the X protocol major version the server supports (should always be 11) ๐Ÿ‘‘
  • VENDOR="vendor" โ€” a string literal naming the vendor of the server ๐ŸŽ€
  • VNDR_name โ€” the VENDOR name string turned into a legal identifier. So "MIT X Consortium" becomes VNDR_MIT_X_Consortium โญ
  • EXT_name โ€” a symbol gets defined for each protocol extension the server supports. Each extension name gets turned into a legal identifier, so "X3D-PEX" becomes EXT_X3D_PEX ๐Ÿงš
  • NUM_SCREENS=num โ€” the total number of screens ๐Ÿ’…
  • SCREEN_NUM=num โ€” the number of the current screen, counting from zero ๐Ÿ™ˆ
  • BITS_PER_RGB=num โ€” the number of significant bits in an RGB color spec. It's the log base 2 of how many distinct shades of each primary the hardware can make. Heads up, it usually isn't related to PLANES ๐Ÿซถ
  • CLASS=visualclass โ€” one of StaticGray, GrayScale, StaticColor, PseudoColor, TrueColor, or DirectColor. This is the visual class of the root window ๐ŸŒธ
  • CLASS_visualclass=visualid โ€” the visual class of the root window, in a form you can #ifdef on. The value is the numeric id of the visual ๐Ÿ’–
  • COLOR โ€” only defined if CLASS is one of StaticColor, PseudoColor, TrueColor, or DirectColor ๐ŸŒˆ
  • CLASS_visualclass_depth=num โ€” a symbol gets defined for each visual the screen supports. The symbol includes the visual's class and depth, and the value is the numeric id of the visual. (If more than one visual has the same class and depth, the numeric id of the first one the server reports gets used ๐Ÿฆ‹)
  • HEIGHT=num โ€” the height of the root window in pixels ๐Ÿ“
  • WIDTH=num โ€” the width of the root window in pixels ๐Ÿ“
  • PLANES=num โ€” the number of bit planes (the depth) of the root window ๐Ÿ“
  • X_RESOLUTION=num โ€” the x resolution of the screen in pixels per meter ๐Ÿ’œ
  • Y_RESOLUTION=num โ€” the y resolution of the screen in pixels per meter ๐Ÿ’œ

Quick note on the identifiers: SRVR_name, CLNT_name, VNDR_name, and EXT_name are all made by swapping every character that isn't a letter or digit for an underscore (_) ๐Ÿซถ

Lines that start with an exclamation mark (!) get ignored, so you can use them as comments ๐Ÿ™ˆ

And since xrdb can read from standard input, you can change the contents of properties directly from a terminal or a shell script. main character energy ๐Ÿ˜คโœจ

โš™๏ธ OPTIONS

okay so the xrdb program takes these options ๐ŸŽ€

  • -help โ€” this one (or literally any option it doesn't support) prints a short description of the allowed options and parameters ๐Ÿ’€
  • -version โ€” prints the xrdb version and then exits, without doing anything else ๐ŸŒธ
  • -display display โ€” picks the X server to use. See X(7) for the deets ๐Ÿ–ฅ๏ธ It also decides which screen -screen uses, and which screen the preprocessor symbols come from for -global ๐Ÿฆ‹
  • -all โ€” the operation runs on the screen-independent RESOURCE_MANAGER property and on the screen-specific SCREEN_RESOURCES property of every screen on the display ๐Ÿ’– For example, pair it with -query and you get the contents of every property printed out ๐Ÿ–จ๏ธ With -load, -override, or -merge, the input file gets processed once per screen. Whatever resources show up in common across every screen's output get collected and applied as the screen-independent resources, and the leftovers get applied to each individual per-screen property ๐Ÿง  This is the default mode of operation, no cap ๐Ÿ‘‘
  • -global โ€” only touches the screen-independent RESOURCE_MANAGER property ๐ŸŒ
  • -screen โ€” only touches the SCREEN_RESOURCES property of the default screen of the display ๐Ÿ–ผ๏ธ
  • -screens โ€” touches the SCREEN_RESOURCES property of each screen on the display ๐ŸŒˆ For -load, -override, and -merge, the input file gets processed for each screen ๐Ÿ”
  • -n โ€” when you use it with -load, -override, or -merge, the changes to the properties get shown on standard output but not actually made. With -edit, the same goes for the resource file ๐Ÿ‘€
  • -quiet โ€” hides the warnings about duplicate entries ๐Ÿคซ
  • -cpp filename โ€” the pathname of the C preprocessor program you want to use. xrdb was built around CPP, but any filter program that takes the -D, -I, and -U options will work ๐Ÿงช
  • -nocpp โ€” tells xrdb to skip the preprocessor step and load the input file straight into the properties ๐Ÿšซ
  • -undef โ€” passed along to the C preprocessor if you use it. It stops the preprocessor from predefining any system-specific macros ๐Ÿงน
  • -E โ€” shows any cpp command that gets run, plus its output, on standard output ๐Ÿ‘€ If you also used -nocpp, the input file gets shown just as it was read. The changes still happen unless you also use -n โœจ
  • -symbols โ€” prints the symbols that are defined for the preprocessor onto standard output ๐Ÿ“‹
  • -query โ€” prints the current contents of the specified properties onto standard output ๐Ÿ“ค Heads up, bestie: preprocessor commands live in the input resource file, not in the property itself, so they won't show up in this output ๐Ÿ˜ญ If you want to merge property contents back into your input file without wrecking those preprocessor commands, use -edit instead ๐Ÿซถ
โš ๏ธ Preprocessor lines only exist in the input file, so -query output won't include them. Use -edit if you want to keep them safe.

That's the first half, babes! ๐ŸŒˆ๐Ÿ’– More options are coming up next.

๐Ÿ“ FILES ๐Ÿ“

okay so xrdb doesn't load any files on its own ๐Ÿ™ˆ but lots of desktop environments use it to load ~/.Xresources files when your session starts up. It's basically what sets up the resource database, and it's a generalized replacement for ~/.Xdefaults files ๐Ÿ’…โœจ

๐Ÿ”— SEE ALSO ๐Ÿ”—

  • X(7) ๐ŸŒธ
  • appres(1) ๐Ÿฆ‹
  • listres(1) ๐Ÿฆ‹
  • Xlib Resource Manager documentation ๐Ÿ“š
  • Xt resource documentation ๐Ÿ“š

๐ŸŒ ENVIRONMENT ๐ŸŒ

  • DISPLAY โ€” this is how xrdb figures out which display to use ๐Ÿ–ฅ๏ธ๐Ÿ’–

๐Ÿ™ˆ BUGS ๐Ÿ™ˆ

bestie, this one is a known issue ๐Ÿ˜ญ the default for no arguments should be to query, not to overwrite, so it matches how other programs act. right now it doesn't, so be careful ๐Ÿ’€

๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

Bob Scheifler and Phil Karlton wrote the original, and Jim Gettys rewrote it from there ๐Ÿซถ๐ŸŽ€


that's the whole page, bestie ๐Ÿงš X Version 11 with xrdb 1.2.2, and xrdb's manual page is XRDB(1), so you're all set ๐Ÿ’œ๐ŸŒˆ

๐Ÿ“ฆ where this page comes from