#!/bin/sh
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

# Effectively disable DPMS by setting values to 0 as laptop screen does not resume
# Use standard blank screen saver after 5 minutes
#export DISPLAY=:0.0
xset s 300
xset s blank
xset dpms 0 0 0

# Start XScreensaver in background
# xscreensaver &

# Use terminology as the default term emulator in eg i3
export TERMINAL=terminology

# Disable bell
xset -b

# Enable zapping (C-A-<Bksp> kills X)
setxkbmap -option terminate:ctrl_alt_bksp

# Enforce correct locales from the beginning
unset LC_COLLATE
export LC_CTYPE=en_AU.UTF-8
export LC_TIME=en_AU.UTF-8
export LC_NUMERIC=en_AU.UTF-8
export LC_MONETARY=en_AU.UTF-8
export LC_MESSAGES=C
export LC_PAPER=en_AU.UTF-8
export LC_NAME=en_AU.UTF-8
export LC_ADDRESS=en_AU.UTF-8
export LC_TELEPHONE=en_AU.UTF-8
export LC_MEASUREMENT=en_AU.UTF-8
export LC_IDENTIFICATION=en_AU.UTF-8

# Use XToolkit in java applications
export AWT_TOOLKIT=XToolkit

# Set background color
xsetroot -solid "#333333"

# Enable core dumps in case something goes wrong
ulimit -c unlimited

# Append "$1" to $PATH when not already in.
append_path () {
    case ":$PATH:" in
        *:"$1":*)
            ;;
        *)
            PATH="${PATH:+$PATH:}$1"
    esac
}

# Append our default paths
append_path '/home/frederik/scripts'

# Start i3 and log to ~/.i3logfile
echo "Starting at $(date)" >> ~/.i3logfile
#exec /usr/bin/i3
exec startxfce4