60 lines
1.7 KiB
Bash
60 lines
1.7 KiB
Bash
#!/bin/bash
|
|
#
|
|
# xbindkeys.sh - load keyboard binding data for specific machine
|
|
#
|
|
# Copyright (c) 2008 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
|
#
|
|
|
|
[ -e /etc/sysconfig/machine ] && . /etc/sysconfig/machine
|
|
|
|
XMODMAP_CONFDIR=/usr/share/X11/xmodmap
|
|
unset XMODMAP_INPUTFILE XBINDKEYS_INPUTFILE
|
|
XBINDKEYS_CONFDIR=/usr/share/X11/xbindkeys
|
|
SCRIPT_DIR=/usr/share/X11/scripts
|
|
|
|
system_manufacturer=`echo ${SYSTEM_MANUFACTURER/ *} | tr '[:upper:]' '[:lower:]'`
|
|
system_product_name=`echo ${SYSTEM_PRODUCT_NAME/ *} | tr '[:upper:]' '[:lower:]'`
|
|
system_version=`echo ${SYSTEM_VERSION/ *} | tr '[:upper:]' '[:lower:]'`
|
|
|
|
s1=$system_manufacturer
|
|
s2=$system_manufacturer/$system_product_name
|
|
s3=$system_manufacturer/$system_product_name/$system_version
|
|
|
|
# check for xbindkeysrc file
|
|
for i in $s3 $s2 $s1 ""; do
|
|
[ -r ${XBINDKEYS_CONFDIR}/$i/xbindkeysrc ] && {
|
|
XBINDKEYS_INPUTFILE=${XBINDKEYS_CONFDIR}/$i/xbindkeysrc
|
|
break
|
|
}
|
|
done
|
|
|
|
# check for xmodmap file
|
|
for i in $s3 $s2 $s1 ""; do
|
|
[ -r ${XMODMAP_CONFDIR}/$i/xmodmap ] && {
|
|
XMODMAP_INPUTFILE=${XMODMAP_CONFDIR}/$i/xmodmap
|
|
break
|
|
}
|
|
done
|
|
|
|
# check for post script file
|
|
for i in $s3 $s2 $s1 ""; do
|
|
[ -r ${SCRIPT_DIR}/$i/post ] && {
|
|
POST_SCRIPT_FILE=${SCRIPT_DIR}/$i/post
|
|
break
|
|
}
|
|
done
|
|
|
|
[ -e "$XMODMAP_INPUTFILE" ] && {
|
|
xmodmap $XMODMAP_INPUTFILE
|
|
[ "$VERBOSE" ] && echo "Loading xmodmap input file $XMODMAP_INPUTFILE"
|
|
}
|
|
|
|
[ -e "$XBINDKEYS_INPUTFILE" ] && {
|
|
xbindkeys -f $XBINDKEYS_INPUTFILE
|
|
[ "$VERBOSE" ] && echo "Loading xmodmap input file $XBINDKEYS_INPUTFILE"
|
|
}
|
|
|
|
[ -e "$POST_SCRIPT_FILE" ] && {
|
|
[ "$VERBOSE" ] && echo "Executing post script file $POST_SCRIPT_FILE"
|
|
. $POST_SCRIPT_FILE
|
|
} |