From dafeaa790bc356a6669072bc5119a81a0de5a74e Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sun, 14 Aug 2011 19:36:45 +0200 Subject: [PATCH] xorg: configure keyboard using /etc/X11/xorg.conf.d/ directory; requires Xorg >= 1.10 --- postplug.d/30xorg | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/postplug.d/30xorg b/postplug.d/30xorg index 69142ee..ddfaaab 100644 --- a/postplug.d/30xorg +++ b/postplug.d/30xorg @@ -106,39 +106,42 @@ _EOF } } -function xorg_hal_configure_keyboard() { - # Keyboard configuration (Xorg >= 1.4 uses HAL) - [ ! -e /etc/hal/fdi/policy/10-keymap.fdi -o \ - /etc/sysconfing/keyboard -nt /etc/hal/fdi/policy/10-keymap.fdi ] && { +function xorg_d_configure_keyboard() { + # Keyboard configuration (Xorg >= 1.8 uses /etc/X11/xorg.conf.d) + [ ! -e /etc/X11/xorg.conf.d/10-keyboard.conf -o \ + /etc/sysconfing/keyboard -nt /etc/X11/xorg.conf.d/10-keyboard.conf ] && { if [ ! "$XKB_MODEL" -o ! "$XKB_LAYOUT" ]; then case "${LANG:0:2}" in it) - XKB_MODEL="pc105" +# XKB_MODEL="pc105" XKB_LAYOUT="it" ;; de) - XKB_MODEL="pc105" +# XKB_MODEL="pc105" XKB_LAYOUT="de" ;; es) - XKB_MODEL="pc105" +# XKB_MODEL="pc105" XKB_LAYOUT="es" ;; fr) - XKB_MODEL="pc105" +# XKB_MODEL="pc105" XKB_LAYOUT="fr" ;; *) - XKB_MODEL="pc104" +# XKB_MODEL="pc104" XKB_LAYOUT="us" ;; esac fi - cat > /etc/hal/fdi/policy/10-keymap.fdi << __EOF - - - $XKB_LAYOUT - $XKB_MODEL - base - + cat > /etc/X11/xorg.conf.d/10-keyboard.conf << __EOF +Section "InputClass" + Identifier "Keyboard Defaults" + MatchIsKeyboard "on" + Driver "evdev" + Option "XkbLayout" "$XKB_LAYOUT" __EOF +[ "$XKB_MODEL" ] && echo " Option \"XkbModel\" \"$XKB_MODEL\"" >>/etc/X11/xorg.conf.d/10-keyboard.conf +[ "$XKB_VARIANT" ] && echo " Option \"XkbVariant\" \"$XKB_VARIANT\"" >>/etc/X11/xorg.conf.d/10-keyboard.conf +[ "$XKB_OPTIONS" ] && echo " Option \"XkbOptions\" \"$XKB_OPTIONS\"" >>/etc/X11/xorg.conf.d/10-keyboard.conf +echo "EndSection" >>/etc/X11/xorg.conf.d/10-keyboard.conf } } @@ -200,7 +203,7 @@ if [ ! -e $XORGCONF ]; then HOME=/tmp Xorg :5 -configure 2>>$logfile || { logmsg "$me" "warning: xorg autoprobed configuration failed; enabling experimental xorg autoconfig" xorg_configure_loginmanager - xorg_hal_configure_keyboard + xorg_d_configure_keyboard exit 1 } @@ -478,7 +481,7 @@ sed -i "/[[:space:]]*InputDevice[[:space:]]*.*PS2Mouse.*/d; \ sed -i "/\W*Option \"Device\".*/d" $XORGCONF # Configure keyboard -xorg_hal_configure_keyboard +xorg_d_configure_keyboard # disable keyboard configuration for Xorg >= 1.4 sed -i "s|^\([[:space:]]*InputDevice\W*\"Keyboard0\".*\)|#\1|" $XORGCONF