#!/bin/sh

GCONF=/etc/hotkeys.conf
LCONF=${HOME}/.hotkeys/hotkeys.conf

if ! echo $DISPLAY | grep ^:[0-9] > /dev/null 2>&1; then
	exit 0
fi

if [ -e ${GCONF} ]; then
	if grep "^Kbd=" ${GCONF} > /dev/null 2>&1; then
		KBDFILE=`grep "^Kbd=" ${GCONF} | cut -f2 -d=`
	fi
fi

if [ -e ${LCONF} ]; then
	if grep "^Kbd=" ${LCONF} > /dev/null 2>&1; then
		KBDFILE=`grep "^Kbd=" ${LCONF} | cut -f2 -d=`
	fi
fi

if [ -e ${HOME}/.hotkeys/${KBDFILE}.def -o \
     -e /usr/share/hotkeys/${KBDFILE}.def ]; then
	/usr/bin/hotkeys
fi
