xorg: can't call localectl in postplug, so create 00-keyboard.conf

This commit is contained in:
Silvan Calarco 2014-06-30 00:13:38 +02:00
parent 8598291d84
commit 2244f457a3

View File

@ -72,6 +72,7 @@ fi
function xorg_d_configure_input() { function xorg_d_configure_input() {
# Keyboard configuration (Xorg >= 1.8 uses /etc/X11/xorg.conf.d) # Keyboard configuration (Xorg >= 1.8 uses /etc/X11/xorg.conf.d)
[ ! -e /etc/X11/xorg.conf.d/00-keyboard.conf ] && { [ ! -e /etc/X11/xorg.conf.d/00-keyboard.conf ] && {
if [ ! "$XKB_MODEL" -o ! "$XKB_LAYOUT" ]; then if [ ! "$XKB_MODEL" -o ! "$XKB_LAYOUT" ]; then
case "${LANG:0:2}" in case "${LANG:0:2}" in
it) it)
@ -91,20 +92,30 @@ function xorg_d_configure_input() {
XKB_LAYOUT="us" ;; XKB_LAYOUT="us" ;;
esac esac
fi fi
# configure keyboard options for Apple computers
if [ "${SYSTEM_MANUFACTURER:0:5}" = "Apple" ]; then cat > /etc/X11/xorg.conf.d/00-keyboard.conf << __EOF
XKB_OPTIONS="$XKB_OPTIONS,lv3:rwin_switch" # Created by postplug
fi Section "InputClass"
localectl set-x11-keymap $XKB_LAYOUT $XKB_MODEL $XKB_VARIANT $XKB_OPTIONS && { Identifier "system-keyboard"
if [ -e /etc/X11/xorg.conf.d/10-keyboard.conf ]; then MatchIsKeyboard "on"
rm -f /etc/X11/xorg.conf.d/10-keyboard.conf Option "XkbLayout" "$XKB_LAYOUT"
fi __EOF
if [ -e /etc/X11/xorg.conf.d/15-keyboard-apple.conf ]; then [ "$XKB_MODEL" ] && echo " Option \"XkbModel\" \"$XKB_MODEL\"" >>/etc/X11/xorg.conf.d/00-keyboard.conf
rm -f /etc/X11/xorg.conf.d/15-keyboard-apple.conf [ "$XKB_VARIANT" ] && echo " Option \"XkbVariant\" \"$XKB_VARIANT\"" >>/etc/X11/xorg.conf.d/00-keyboard.conf
fi if [ "${SYSTEM_MANUFACTURER:0:5}" = "Apple" ]; then
} XKB_OPTIONS="${XKB_OPTIONS},lv3:rwin_switch"
fi
[ "$XKB_OPTIONS" ] && echo " Option \"XkbOptions\" \"$XKB_OPTIONS\"" >>/etc/X11/xorg.conf.d/00-keyboard.conf
echo "EndSection" >>/etc/X11/xorg.conf.d/00-keyboard.conf
} }
if [ -e /etc/X11/xorg.conf.d/10-keyboard.conf ]; then
rm -f /etc/X11/xorg.conf.d/10-keyboard.conf
fi
if [ -e /etc/X11/xorg.conf.d/15-keyboard-apple.conf ]; then
rm -f /etc/X11/xorg.conf.d/15-keyboard-apple.conf
fi
[ ! -e /etc/X11/xorg.conf.d/20-synaptics.conf ] && { [ ! -e /etc/X11/xorg.conf.d/20-synaptics.conf ] && {
cat > /etc/X11/xorg.conf.d/20-touchpad.conf << __EOF cat > /etc/X11/xorg.conf.d/20-touchpad.conf << __EOF
Section "InputClass" Section "InputClass"
@ -491,7 +502,6 @@ sed -i "/\W*Option \"Device\".*/d" $XORGCONF
# remove obsoleted XAANoOffscreenPixmaps # remove obsoleted XAANoOffscreenPixmaps
sed -i '/^[[:space:]]*Option[[:space:]]*"XAANoOffscreenPixmaps" "true"/d' $XORGCONF sed -i '/^[[:space:]]*Option[[:space:]]*"XAANoOffscreenPixmaps" "true"/d' $XORGCONF
# disable keyboard configuration for Xorg >= 1.4 # disable keyboard configuration for Xorg >= 1.4
sed -i "s|^\([[:space:]]*InputDevice\W*\"Keyboard0\".*\)|#\1|" $XORGCONF sed -i "s|^\([[:space:]]*InputDevice\W*\"Keyboard0\".*\)|#\1|" $XORGCONF