b9ec32
# Copyright (C) 1999 - 2004 Red Hat, Inc. All rights reserved. This
b9ec32
# copyrighted material is made available to anyone wishing to use, modify,
b9ec32
# copy, or redistribute it subject to the terms and conditions of the
b9ec32
# GNU General Public License version 2.
b9ec32
#
b9ec32
# You should have received a copy of the GNU General Public License
b9ec32
# along with this program; if not, write to the Free Software
b9ec32
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
b9ec32
b9ec32
# xinitrc-common
b9ec32
#
b9ec32
# This is common code shared by both Xsession and xinitrc scripts.  Be sure
b9ec32
# to take this into account when fixing bugs or adding new functionality.
b9ec32
b9ec32
# Set up i18n environment
b9ec32
if [ -r /etc/profile.d/lang.sh ]; then
b9ec32
  . /etc/profile.d/lang.sh
b9ec32
fi
b9ec32
b9ec32
[ -r $HOME/.profile ] && . $HOME/.profile
b9ec32
b9ec32
userresources=$HOME/.Xresources
b9ec32
usermodmap=$HOME/.Xmodmap
b9ec32
userxkbmap=$HOME/.Xkbmap
b9ec32
b9ec32
sysresources=/etc/X11/Xresources
b9ec32
sysmodmap=/etc/X11/Xmodmap
b9ec32
sysxkbmap=/etc/X11/Xkbmap
b9ec32
b9ec32
# merge in defaults
b9ec32
[ -r "$sysresources" ] && xrdb -nocpp -merge "$sysresources"
b9ec32
[ -r "$userresources" ] && xrdb -merge "$userresources"
b9ec32
b9ec32
# merge in keymaps
b9ec32
if [ -r "$sysxkbmap" ]; then
b9ec32
    setxkbmap $(cat "$sysxkbmap")
b9ec32
fi
b9ec32
b9ec32
if [ -r "$userxkbmap" ]; then
b9ec32
    setxkbmap $(cat "$userxkbmap")
b9ec32
fi
b9ec32
b9ec32
# xkb and xmodmap don't play nice together
b9ec32
if ! [ -r "$sysxkbmap" -o -r "$userxkbmap" ] ; then
b9ec32
    [ -r "$sysmodmap" ] && xmodmap "$sysmodmap"
b9ec32
    [ -r "$usermodmap" ] && xmodmap "$usermodmap"
b9ec32
fi
b9ec32
b9ec32
# run all system xinitrc shell scripts.
b9ec32
for file in /etc/X11/xinit/xinitrc.d/* ; do
b9ec32
        . $file
b9ec32
done
b9ec32
b9ec32
# Prefix launch of session with ssh-agent if available and not already running.
b9ec32
if [ -z "$SSH_AGENT" ] && [ -z "$SSH_AUTH_SOCK" ] && [ -z "$SSH_AGENT_PID" ] && [ -x /usr/bin/ssh-agent ]; then
b9ec32
    if [ "x$TMPDIR" != "x" ]; then
b9ec32
        SSH_AGENT="/usr/bin/ssh-agent /bin/env TMPDIR=$TMPDIR"
b9ec32
    else
b9ec32
        SSH_AGENT="/usr/bin/ssh-agent"
b9ec32
    fi
b9ec32
fi