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