Softpanorama

May the source be with you, but remember the KISS principle ;-)
Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and  bastardization of classic Unix

.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.


Top Visited
Switchboard
Latest
Past week
Past month

NEWS CONTENTS

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



Etc

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D


Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to to buy a cup of coffee for authors of this site

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Last modified: March 12, 2019