#!/bin/sh -x

exec >>${HOME}/${0##*/}.log 2>&1;

. ~/.bash_profile;

xhost +;

# old, from 2014-12-01T11:06:23
#eg1=$(xinput list|grep "eGalaxTouch Virtual Device for Single" | awk 'BEGIN {FS="="}; { print($2);};' | awk '{print($1);};');
#eg2=$(xinput list|grep "eGalax Inc. USB TouchController" | awk 'BEGIN {FS="="}; { print($2);};' | awk '{print($1);};');
#if [[ -n "$eg1" && -n "$eg2" ]]; then
#	for id in $eg2; do
#		echo "xinput disable $id";
#		xinput disable $id;
#	done
#fi

for id in `xinput list | grep "eGalax Inc. USB TouchController" | awk 'BEGIN {FS="="}; { print($2);};' | awk '{print($1);};'`; do
	echo "xinput disable $id";
	xinput disable $id;
	#xinput set-prop $id "Device Enabled" 0;
done

# start prgs
[[ -x ~/.x11/autoexec ]]        && ~/.x11/autoexec;

setxkbmap "us,ru" ",winkeys" "grp:shifts_toggle,grp_led:scroll";
setxkbmap -option "terminate:ctrl_alt_bksp";
setxkbmap -option "compose:ralt";
xmodmap -e "clear mod5" -e "add mod5 = Menu" -e "keycode 135 = Hyper_L"; # 135==Menu for xbindkeys graves

[[ -x "/usr/bin/ck-launch-session" ]] && LAUNCH_SESSION="/usr/bin/ck-launch-session" || LAUNCH_SESSION="";
echo "start session ($USER): $LAUNCH_SESSION openbox-session";
#$LAUNCH_SESSION openbox-session;
$LAUNCH_SESSION /usr/bin/openbox --startup "$HOME/.config/openbox/autostart.sh";

my_pids=$(pgrep -u $USER | grep -v $$);
my_pids=$(echo $my_pids | sed 's, [^ ]\+ [^ ]\+$,,');
kill $my_pids;


# vim:ts=2 sw=2:
