Softpanorama
(slightly skeptical) Open Source Software Educational Society

May the source be with you, but remember the KISS principle ;-)

Softpanorama Search

.Xresources

News Recommended Links Minitutorial Architecture X display manager XDMCP Troubleshooting
Configuration Fonts in X Exporting_display Xdefaults xrdb   Using xauth
vnc Cygwin/X X11 security Tips History Humor Etc

The file .Xresources is a plain text file, so you can create it with any application that can save a file as plain ASCII text. difference between .XResources and .XDefaults is fuzzy so many users symlink .Xdefaults to .Xresources file

Here is how this topic is explained in X resources  Wikipedia article:

During X server execution, the X resources are stored in two standard locations, depending on whether they apply to all screens or to a particular one:
  1. the RESOURCE_MANAGER property of the root window of screen 0
  2. the SCREEN_RESOURCES property of the root window of an arbitrary screen
 X resources are accessible to all programs connected to the X server, even if running on different computers.

X resources are stored in the server rather than in a configuration file to allow programs started from other computers to use them. Indeed, a program connecting to an X server from another computer can access the resources via the X protocol. Using the old system of storing program parameters in the .Xdefaults file creates the need of copying this file to all other computers where a program can be started.

Resources are manipulated by the xrdb program. In particular, many X server configurations run xrdb at start up, instructing it to read the resources from the .Xresources file in the user's home directory. From this point on, every other program finds the resources in the two standard locations. You can view the current resources from a console with xrdb -query.


Notes:
  • This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Some amount of grammar and spelling errors should be expected.
  • The site contain some broken links as it develops like a living tree... Please try to use Google, Open directory, etc. to find a replacement link (see HOWTO search the WEB for details). We would appreciate if you can mail us a correct link.
Google Search
Open directory

Research Index


Old News ;-)

Arch Linux Forums - [SOLVED] .Xdefaults vs. .Xresources

bernarcher
Member

Registered: 2009-02-17
Posts: 244[SOLVED] .Xdefaults vs. .XresourcesI am slightly confused about the roles the .Xdefaults and .Xresources files play in Arch.

As far as I understand, based on my (B)LFS experiences, .Xdefaults was considered obsolete and should have been replaced by .Xresources. 
Now I know many applications still refer to .Xdefaults instead of .Xresources, 
thus I symlinked .Xdefaults to my .Xresources file. 
But is this advisable? 
Are .Xdefaults definitions in any way different from the .Xresources ones?

Is there as rationale why .Xdefaults was preferred over .Xresources? 
The wiki not even mentiones .Xresources in the .Xdefaults article. 
And a wiki search for .Xresources finds more inferior mentions only.
How is this handled in other distributions?

Last edited by bernarcher (2009-05-08 15:17:35)

--------------------------------------------------------------------------------
To know or not to know ...
... the questions remain forever.Offline
 #2 2009-05-08 04:13:35
adamlau
Member

From: San Gabriel Valley
Registered: 2009-01-30
Posts: 188Re: [SOLVED] .Xdefaults vs. .XresourcesAll I know is that urxvt follows .Xdefaults and xterm, .Xresources.

--------------------------------------------------------------------------------
NetBSD 64-bit + Xfce
ArchLinux 64-bit + JWMOffline
 #3 2009-05-08 04:48:01
Wra!th
Member

Registered: 2009-03-31
Posts: 267Re: [SOLVED] .Xdefaults vs. .Xresourcesadamlau wrote:
All I know is that urxvt follows .Xdefaults and xterm, .Xresources.
Not really..I don't even have an .Xresources. All my X user life I've been doing everything with ~/.Xdefaults

--------------------------------------------------------------------------------
点ファイル http://dotfiles.org/~wraith/.Xdefaults
http://github.com/wraith0x2b/barewm/Offline
 #4 2009-05-08 06:37:53
app4des
Member
Registered: 2009-02-18
Posts: 28Re: [SOLVED] .Xdefaults vs. .Xresources.Xresources and .Xdefaults files are read when X starts (Different applications don't read different files, the xrdb database is the same). Which file is read probably depends on the Xorg version.

Whatever, just ignore these files and load your own with "xrdb" on some 
startup scripts. "xrdb whateverfile" will work too. Don't forget to use 
"xrdb -merge" if you want to load multiple files, because else each resource 
file overwrites the previous resources.

Personally I use something like that in the openbox's autostart.sh so I can have all the configurations on that file:

echo "URxvt.background:black" | xrdb -merge
echo "URxvt.foreground:white" | xrdb -merge
etc . .

Last edited by app4des (2009-05-08 06:38:31)
Offline
 #5 2009-05-08 07:04:01
bernarcher
Member

Registered: 2009-02-17
Posts: 244Re: [SOLVED] .Xdefaults vs. .XresourcesNaah. This xrdb stuff is awkward. It should be used for individual adaptations only. Those centralized .X... resource definitions are for a purpose.

Yet it is true, .Xdefaults/.Xresources should be processed by xrdb on Xorg startup. Nonetheless, 
I found some X applications failing if either one was missing.

I did not check for some time, however. 
Just remember some urxvt initialization problems when no .Xdefaults was present.

I just found this one in the "X Resources" Wikipedia article:


X resources are stored in the server rather than in a configuration file to allow programs started from other computers to use them. Indeed, a program connecting to an X server from another computer can access the resources via the X protocol. Using the old system of storing program parameters in the .Xdefaults file creates the need of copying this file to all other computers where a program can be started.
So there are differences, but when and how do they really matter.?

--------------------------------------------------------------------------------
To know or not to know ...
... the questions remain forever.Offline
 #6 2009-05-08 12:36:41
app4des
Member
Registered: 2009-02-18
Posts: 28Re: [SOLVED] .Xdefaults vs. .XresourcesThe problem that many people may have is that if both .Xdefaults and .Xresources are being read by X at start up, the one that is read last will delete all the resources mentioned by the other, that is because probably X uses standard xrdb and not xrdb -merge.

Using "xrdb -merge" manually on a file (or files) yourself as I mentioned before will solve all problems.

You can always see what resources have been parsed anytime with "xrdb -query" (from within X session).
Offline
 #7 2009-05-08 15:17:02
bernarcher
Member

Registered: 2009-02-17
Posts: 244Re: [SOLVED] .Xdefaults vs. .XresourcesNow I got it. 
This did bother me for years. Kind of a relief.

Thanks!

--------------------------------------------------------------------------------
To know or not to know ...
... the questions remain forever.

Xresources not read at startup debianHELP

Xresources not read at startup

Submitted by Kelly Clowers on Wed, 2007-11-21 23:00.

On Nov 21, 2007 7:07 PM, Kumar Ravichandran
wrote:

> On Wed, Nov 21, 2007 at 04:52:29PM +0100, s. keeling wrote:
> > Kumar Ravichandran :
> > >
> > > I am running Debian Etch on a Macbook, and I have a simple problem,
> > > namely, that my $HOME/.Xresources file, which has a few colour options
> > > for xterm, is not read at startup. I need to manually xrdb load it
> >
> > I have it in ~/.xinitrc
> >
> I tried that as well :(. No good!

I made .Xdefaults a symlink to .Xresources, and it started working.
Might be worth a try.

Cheers,
Kelly Clowers

Xresources not read at startup

Submitted by Michelle Konzack on Mon, 2007-12-03 09:04.
 

Am 2007-11-21 19:39:26, schrieb Kelly Clowers:
> I made .Xdefaults a symlink to .Xresources, and it started working.
> Might be worth a try.

Please note, that

~/.Xresources

are different from

~/.Xdefaults-
or
~/.Xdefaults

While the first one is read by the "xserver" from

/etc/X11/Xsession.d/30x11-common

the later two are read by the application directly at every startup.

Thanks, Greetings and nice Day

Michelle Konzack
Tamay Dogan Network
Open Hardware Developer
Debian GNU/Linux Consultant

Xresources not read at startup

Submitted by Michelle Konzack on Mon, 2007-12-03 09:06.

 

Am 2007-11-21 00:43:39, schrieb Kumar Ravichandran:
> Hi,
>
> I am running Debian Etch on a Macbook, and I have a simple problem,
> namely, that my $HOME/.Xresources file, which has a few colour options

Why not put it into

$HOME/.Xdefaults-
or
$HOME/.Xdefaults

which are read by default troug the application?

----[ '~/devel/editres.strace' ]----------------------------------------

execve("/usr/bin/editres", ["editres"], [/* 78 vars */]) = 0

open("/home/michelle.konzack/.Xdefaults-michelle1.private", O_RDONLY) = 4
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

read(4, "\n. ~/.Xdefaults\n", 16) = 16

access("/home/michelle.konzack/.Xresources/de_DE.UTF8/Editres", R_OK) = -1 ENOENT (No such file or directory)
access("/home/michelle.konzack/.Xresources/de/Editres", R_OK) = 0
stat64("/home/michelle.konzack/.Xresources/de/Editres", {st_mode=S_IFREG|0664, st_size=671, ...}) = 0
open("/home/michelle.konzack/.Xresources/de/Editres", O_RDONLY) = 4

open("/home/michelle.konzack/.Xresources/de/Editres-real", O_RDONLY) = 4

open("/home/michelle.konzack/.Xresources/de/Editres-lang", O_RDONLY) = 4

access("/usr/lib/X11/de_DE.UTF8/app-defaults/Editres", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/X11/de/app-defaults/Editres", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/X11/app-defaults/Editres", R_OK) = -1 ENOENT (No such file or directory)
access("/etc/X11/de_DE.UTF8/app-defaults/Editres", R_OK) = -1 ENOENT (No such file or directory)
access("/etc/X11/de/app-defaults/Editres", R_OK) = -1 ENOENT (No such file or directory)
access("/etc/X11/app-defaults/Editres", R_OK) = 0
stat64("/etc/X11/app-defaults/Editres", {st_mode=S_IFREG|0644, st_size=10027, ...}) = 0
open("/etc/X11/app-defaults/Editres", O_RDONLY) = 4

open("/home/michelle.konzack/.icons/default/cursors/sb_v_double_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/michelle.konzack/.icons/default/index.theme", O_RDONLY) = 4

open("/usr/share/icons/default/cursors/sb_v_double_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/pixmaps/default/cursors/sb_v_double_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/X11R6/lib/X11/icons/default/cursors/sb_v_double_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/michelle.konzack/.icons/crystalblue/cursors/sb_v_double_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/michelle.konzack/.icons/crystalblue/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/icons/crystalblue/cursors/sb_v_double_arrow", O_RDONLY) = 4

X Resource Default Configuration

The ~/.Xdefaults file allows you to set global X application defaults all in one place. This is a benefit to you since it frees you from having to type a dozen and one command-line options each time you invoke the command.

... ... ...

Making it GO!
To make your .Xdefaults file take effect, put this code in your .xsession file, before you invoke the window manager:
if [ -f $HOME/.Xdefaults ]; then
  xrdb -merge $HOME/.Xdefaults
fi
The "-merge" argument to xrdb merges your defaults with the system defaults, so don't worry about losing other defaults you might have "forgotten" to set.

 

Re ~-.Xdefaults vs ~-.Xresources (FAQ item)


David I. Schwartz wrote:
hi all -- I after digging around and going in circles, I've decided to finally ask for help... how do Xdefaults and Xresources differ? I've seen people claim they're the same, and others claim that Xdefaults is outdated. Others say that Xresources gets accessed when starting the
window manager, and Xdefaults gets accessed each time an X client is run. I suspect that various systems set things up differently, but perhaps there's a universal standard...?


 
thanks,
Dave
Xlib Programming Manual P.441 
Prior to X11R2, X resource settings were read from .Xdefaults file in users home directory and optionally on whatever machine the X client was running on, so multiple files was hard to maintain.

Later on, xrdb program was made to store users resource settings from in .Xresources into the XA_RESOURCE_MANAGER property of the root window on the current X server, so all clients connected to the same server has access to them. If the user hasn't called xrdb to set the property, then ..Xdefaults is read.

Recommended Links

X resources - Wikipedia, the free encyclopedia

xrdb - Wikipedia, the free encyclopedia

X Window System protocols and architecture

Inessential X Resources for Techno-Dweebs

How do I use X Resources

Resource Manager Functions



Copyright © 1996-2009 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Site uses AdSense so you need to be aware of Google privacy policy. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

Disclaimer:

Last modified: May 24, 2009