#!/bin/sh
#
# GNOME xinitrc Session script.
# Based on:
# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $
#
# Changelog: 
#
# Added ConsoleKit support (2008-10-30) stevek
# Remove unneeded user started dbus session (2008-03-28) stevek
# Add export to XDG_CONFIG_DIRS (2008-03-19) stevek
# Inital version (2008-01-17) stevek
#

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/usr/@LIBDIR@/X11/xinit/.Xresources
sysmodmap=/usr/@LIBDIR@/X11/xinit/.Xmodmap

## Default Session Settings
GNOME_SESSION_SETTINGS=""

## Compiz GNOME
# Change default window manager to compiz instead of metacity
export WINDOW_MANAGER="compiz"

## GNOME XDG Menu Path
# We keep the GNOME menu templates separate from KDE so the two 
# don't interfere with each other. This path may be extended to 
# include the KDE menu path /etc/kde/xdg if the user wishes.
export XDG_CONFIG_DIRS=/etc/xdg:/etc/gnome/xdg

# Merge in defaults and keymaps
if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi
if [ -f $userresources ]; then
    xrdb -merge $userresources
fi
if [ -f $usermodmap ]; then
    xmodmap $usermodmap
fi

## Use ssh-agent if available
if [ -x /usr/bin/ssh-agent ]; then
  GNOME_SESSION_SETTINGS="$GNOME_SESSION_SETTINGS /usr/bin/ssh-agent"
fi;

## Use Seahorse if available
if [ -x /usr/bin/seahorse-agent ]; then
  GNOME_SESSION_SETTINGS="$GNOME_SESSION_SETTINGS /usr/bin/seahorse-agent --execute"
fi;

## Use ConsoleKit if available
if [ -z "${XDG_SESSION_COOKIE}" -a -x /usr/bin/ck-launch-session ]; then
  CK_SESSION="/usr/bin/ck-launch-session"
fi;

# Start the window manager
exec $GNOME_SESSION_SETTINGS $CK_SESSION gnome-session