4 if which "$1" >/dev/null 2>&1; then
12 ( "$@" >/dev/null 2>&1 & )
15 echo "Starting new session"
17 DATE=$(date "+%Y%m%d_%H%M%S")
18 # track xsession errors
19 mv ~/.xsession-errors ~/.xsession-errors_${DATE};
20 ln -sf ~/.xsession-errors_${DATE} ~/.xsession-errors-current;
21 # delete old xsession error files
22 find ~/ -maxdepth 1 -mindepth 1 -type f \
23 -iname '.xsession-errors_*' -ctime +30 -delete;
25 if locale -a |grep -qi en_US.utf8; then
35 export TMPDIR=$(echo ~/tmp)
38 # No clue why this has changed from Alt_R to Down, but we really want Down.
39 if ! xmodmap -pk|grep -qe '116.*Down'; then
40 xmodmap -e 'keycode 116 = Super_L'
41 xmodmap -e 'keycode 115 = Multi_key'
43 xmodmap -e 'clear mod4'
44 xmodmap -e 'add mod4 = Super_L Super_R'
46 if [ -e ~/.Xresources_$HOSTNAME ]; then
47 xrdb -merge < ~/.Xresources_$HOSTNAME;
50 if [ -e ~/.xsession_$HOSTNAME ]; then
51 . ~/.xsession_$HOSTNAME
54 # make a backup of the .Xauthority
55 if [ -e ~/.Xauthority ]; then
56 cp -f .Xauthority .Xauthority.bak
59 if cmd_exists slock && cmd_exists xautolock; then
60 fork xautolock -notifer true -bell 0 -locker slock;
61 elif cmd_exists xscreensaver && [ -e ~/.xscreensaver ]; then
62 fork XENVIRONMENT=~/.xscreensaver /usr/bin/xscreensaver;
63 elif cmd_exists xautolock; then
64 fork xautolock -notifer true -bell 0;
67 if cmd_exists redshift; then
71 if cmd_exists mpd && [ -e ~/.mpdconf ]; then
73 MPD_HOST=$(awk '/^bind_to_address/{print $2}' ~/.mpdconf|sed "s|~|$HOME|; s/^\"//; s/\"$//; ");
75 elif cmd_exists mopidy && [ -e ~/.config/mopidy/mopidy.conf ]; then
79 if [ -x /sbin/iw ] && cmd_exists nm-applet && /sbin/iw list|grep -q '^Wiphy'; then
83 if cmd_exists i3; then
84 if [ -x ~/.config/i3/build_config.sh ]; then
85 ~/.config/i3/build_config.sh;
89 for prog in awesome ion3 openbox stterm st rxvt rxvt-unicode xterm; do
90 if cmd_exists $prog; then