Sophie

Sophie

distrib > PLD > ac > amd64 > media > dist > by-pkgid > 130d6d1d95870ecdf6ab7bad967935a7 > files > 3

xinitrc-ng-0.8-6.noarch.rpm

#
# Standard actions for any xsession
#

# Anybody use this?
[ -f /etc/xprofile ] && . /etc/xprofile
[ -f $HOME/.xprofile ] && . $HOME/.xprofile

# Redirect errors to a file in user's home directory if possible
errfn=xerr-$USER-$DISPLAY
for errfile in "${TMPDIR-/tmp}/$errfn" "/tmp/$errfn" "$HOME/.$errfn"; do
	if cp /dev/null "$errfile" 2> /dev/null ; then
		chmod 600 "$errfile"
		exec > "$errfile" 2>&1
		break
	fi
done

# System wide settings
sysxkbmap=/etc/X11/xinit/Xkbmap
sysmodmap=/etc/X11/xinit/Xmodmap
sysresources=/etc/X11/xinit/Xresources

# Also usable locations
another_sysxkbmap=/etc/X11/Xkbmap
another_sysmodmap=/etc/X11/Xmodmap
another_sysresources=/etc/X11/Xresources

# User settings
userxkbmap=$HOME/.Xkbmap
usermodmap=$HOME/.Xmodmap
userresources=$HOME/.Xresources
userdefaults=$HOME/.Xdefaults

# Merge in defaults
if [ -f $sysresources ]; then
	xrdb -merge $sysresources
elif [ -f $another_sysresources ]; then
	xrdb -merge $another_sysresources
fi		

if [ -f $userresources ]; then
	xrdb -merge $userresources
elif [ -f $userdefaults ]; then
	xrdb -merge $userdefaults
fi

# Merge in keymaps
if [ -f "$sysxkbmap" ]; then
	setxkbmap `cat "$sysxkbmap"`
	XKB_IN_USE=yes
elif [ -f "$another_sysxkbmap" ]; then
	setxkbmap `cat "$another_sysxkbmap"`
	XKB_IN_USE=yes
fi

if [ -f "$userxkbmap" ]; then
	setxkbmap `cat "$userxkbmap"`
	XKB_IN_USE=yes
fi

if [ -z "$XKB_IN_USE" -a ! -L /etc/X11/X ]; then
	if grep '^exec.*/Xsun' /etc/X11/X > /dev/null 2>&1 && [ -f /etc/X11/XF86Config ]; then
		xkbsymbols=`sed -n -e 's/^[ 	]*XkbSymbols[ 	]*"\(.*\)".*$/\1/p' /etc/X11/XF86Config`
		if [ -n "$xkbsymbols" ]; then
			setxkbmap -symbols "$xkbsymbols"
			XKB_IN_USE=yes
		fi
	fi
fi

# xkb and xmodmap don't play nice together
if [ -z "$XKB_IN_USE" ]; then
	if [ -f $sysmodmap ]; then
		xmodmap $sysmodmap
	elif [ -f $another_sysmodmap ]; then
		xmodmap $another_sysmodmap
	fi		
	if [ -f $usermodmap ]; then
		xmodmap $usermodmap
	fi	
fi

unset XKB_IN_USE

# Run all system xinitrc shell scripts.
for i in /etc/X11/xinit/xinitrc.d/* ; do
	if [ -x "$i" ]; then
		. "$i"
	fi
done

# This must be last line !
# vi:syntax=on:ft=sh