#!/bin/sh

if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xprofile" ]; then
    . "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xprofile"
else
    . "$HOME/.xprofile"
fi

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
 for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
  [ -x "$f" ] && . "$f"
 done
 unset f
fi

# My default is dwm for now.
session=${1:-dwm}

case $session in
    i3|i3wm)
        exec i3 ;;
    dwm)
        exec "$HOME/.dwm/start-dwm.sh" ;;
    xmonad)
        exec "$HOME/.xmonad/start-xmonad.sh" ;;
    mint)
        exec cinnamon-session ;;
    gnome)
        exec gnome ;;
    *)
        exec twm ;;
esac
