#!/bin/bash

# merge in defaults and keymaps
sysresources=/etc/X11/xinit/.Xresources ; [ -f "$sysresources"  ] && xrdb -merge "$sysresources"
sysmodmap=/etc/X11/xinit/.Xmodmap       ; [ -f "$sysmodmap"     ] && xmodmap "$sysmodmap"
userresources="$HOME/.Xresources"       ; [ -f "$userresources" ] && xrdb -merge "$userresources"
usermodmap="$HOME/.config/Xmodmap"      ; [ -f "$usermodmap"    ] && xmodmap "$usermodmap"


xset b off          # don't beep! that's annoying as hell
xset r rate 170 60  # delay 170ms, 60 keypresses per second


# fav terminal is xfce4-terminal. I tried out st, but it's way too laggy in its rendering.
export TERMINAL=xfce4-terminal


# default desktop environment to start
[[ -z $DE_CHOICE ]] && DE_CHOICE=i3

# allow to very easily choose a desktop environment without changing this file: do e.g. `DE_CHOICE=kde startx` to choose KDE
case "$DE_CHOICE" in
	awesome) exec awesome;    ;;
	xfce)    exec startxfce4; ;;
	kde)     exec startkde;   ;;

	i3)
		XDG_CONFIG_HOME=$HOME/.config
		compton --config $XDG_CONFIG_HOME/compton/config &>$HOME/.log/my-i3-desktop/compton.log  & # compositor
		dunst    -config $XDG_CONFIG_HOME/dunst/dunstrc  &>$HOME/.log/my-i3-desktop/dunst.log    & # notification daemon
		redshift -c      $XDG_CONFIG_HOME/redshift.conf  &>$HOME/.log/my-i3-desktop/redshift.log & # colour temperature adjuster
		exec i3
		;;

	# We're not able to print messages to the screen here, so do an exec with the error message and X will complain about it for us
	*) exec " DE_CHOICE not recognized: $DE_CHOICE"; ;;
esac

# vim: set noet :
