On Wednesday, January 9th, 2013, at 04:06:35h -0700, Cranky Puss observed:
> Hunting around, I find /etc/X11/app-defaults/, /etc/X11/Xresources/
> and so forth.
As suggested in an earlier posting, leaving the system installed
Xdefaults files where they are since they can be used as a fallback.
Create your own app-defaults directory if you want settings to be
applied to all users under /usr/local. I use /usr/local/X11R6/app-defaults
since I try to keep all locally installed (locally installed means not
installed from the packaging system be it deb or rpm) programs and
related files under /usr/local/X11R6, and most of the files are
actually managed with stow, so are in fact symbolic links to a
/usr/local/stow/{package_name}/X11R6 directory.
You then need to set the environmental variable XAPPLRESDIR to that
path and export it, in a file before the system Xsession file is
called or at the very beginning of the system Xsession file.
It is then a good idea to hunt out the xrdb load script on your system
or create your own and then call that from the system Xsession file.
The advantage of having such a script is that should one need to
re-initialize the loaded X11 resources during an X11 session, one
only has to execute the script, or possibly if one is one using
some remote login and doing some none standard manipulations.
Loading resources for often used applications is more efficient
than reading the file everytime a new instance of the application
is started and there are a X11 applications still in existence which
the lazy(?) programmer has written so that some application properties
are only read from the X11 resource database.
For those who are interested, otherwise hit "n" now
#! /bin/sh
#*****************************************************************************#
#|
#| file : ${X11_ETC}/Xrdb
#|
#*---------------------------------------------------------------------------*#
#*---------------------------------------------------------------------------*#
#
# Set log file environmental variable and delete existing log file.
LOG_XRDB="${HOME}/Log_Xrdb.log"
rm -f ${LOG_XRDB}
#*---------------------------------------------------------------------------*#
#
# Redirect stdout and stderror to log file.
# exec 1> ${LOG_XRDB} 2> ${LOG_XRDB}
# set -x
#*---------------------------------------------------------------------------*#
#
# If environmental variable for display is not set, then exit.
if [ -z ${DISPLAY} ]
then
echo "%ERROR - environmental variable for DISPLAY is not set!" >&2
exit 1
fi
#*---------------------------------------------------------------------------*#
#
# Check that client is authorized to connect to display.
xrdb -symbols 1>/dev/null 2>/dev/null
xrdb_status=${?}
if [ ${xrdb_status} -ne 0 ]
then
echo "%ERROR - unable to connect to display ${DISPLAY}!" >&2
exit 2
fi
unset xrdb_status
#*---------------------------------------------------------------------------*#
#
# Set variable for Xsession options file.
options_file="/etc/X11/Xsession.options"
#*---------------------------------------------------------------------------*#
#
# Process command arguments.
if [ "${1}" = "wait" ]
then
wait=3
else
wait=0
fi
#*---------------------------------------------------------------------------*#
#
# Function to load resources file if resources file is readable.
load_resources ()
{
xrdb_options="${1}"
resource_file="${2}"
test -r "${resource_file}" && xrdb ${xrdb_options} "${resource_file}"
unset xrdb_options resource_file
return
}
#*---------------------------------------------------------------------------*#
#
# If environmental variable for X defaults is not set, then set it.
if [ -z "${XDEFAULTS}" ]
then
if [ -r ${HOME}/.Xdefaults ]
then
XDEFAULTS="${HOME}/.Xdefaults"
else
XDEFAULTS="${XAPPLRESDIR}/.Xdefaults"
fi
export XDEFAULTS
fi
#*---------------------------------------------------------------------------*#
#
# Clear resource manager.
xrdb -remove
#*---------------------------------------------------------------------------*#
#
# Set X terminal class environmental variable if not set.
if [ -z "${X_TERM_CLASS}" ]
then
executable="`command -v urxvt`"
if [ -n "${executable}" ]
then
X_TERM_CLASS="URxvt"
else
executable="`command -v rxvt`"
if [ -n "${executable}" ]
then
X_TERM_CLASS="Rxvt"
else
X_TERM_CLASS="XTerm"
fi
fi
export X_TERM_CLASS
unset executable
fi
#*---------------------------------------------------------------------------*#
#
# Determine if xrdb cpp parameter is set in XSession options file.
xrdb_cpp=""
if [ -r "${options_file}" ]
then
xrdb_parameter="`sed -ne 's|^xrdb-use-cpp=||p' ${options_file}`"
if [ -n "${xrdb_parameter}" ]
then
xrdb_parameter="`command -v ${xrdb_parameter}`"
test -n "${xrdb_parameter}" && xrdb_cpp="-cpp ${xrdb_parameter}"
fi
unset xrdb_parameter
fi
#*---------------------------------------------------------------------------*#
#
# Load resources files.
sleep ${wait}
user="`id | sed -e 's|^[^(]*(\([^)]*\).*|\1|'`"
xrdb -remove
load_resources "${xrdb_cpp} ${X_XRDB_FLAGS}" "${XAPPLRESDIR}/.Xdefaults"
load_resources "${xrdb_cpp} ${X_XRDB_FLAGS}" "${XAPPLRESDIR}/Xft"
test "${DESKTOP}" = "MWM" && \
load_resources "${xrdb_cpp} ${X_XRDB_FLAGS}" "${XAPPLRESDIR}/Mwm"
test "${X_TERM_CLASS}" = "XTerm" || \
load_resources "${xrdb_cpp} -merge" "${XAPPLRESDIR}/${X_TERM_CLASS}"
load_resources "${xrdb_cpp} -merge" "${XAPPLRESDIR}/Emacs"
load_resources "${xrdb_cpp} -merge" "/tmp/.X11-${user}/.xdefaults-${DISPLAY}"
test "${XDEFAULTS}" = "${XAPPLRESDIR}/.Xdefaults" -o \
"${XDEFAULTS}" = "${HOME}/.Xdefaults" || \
load_resources "${xrdb_cpp} -merge" "${XDEFAULTS}"
load_resources "${xrdb_cpp} -merge" "${HOME}/.Xdefaults"
#*---------------------------------------------------------------------------*#
#
# Remove temporary variables.
unset load_resources user wait xrdb_cpp
#*****************************************************************************#