From 2244f457a303f9cc9fbb13e714a2fcfe9ae65f35 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Mon, 30 Jun 2014 00:13:38 +0200 Subject: [PATCH] xorg: can't call localectl in postplug, so create 00-keyboard.conf --- postplug.d/30xorg | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/postplug.d/30xorg b/postplug.d/30xorg index 6862bbd..27768fe 100644 --- a/postplug.d/30xorg +++ b/postplug.d/30xorg @@ -72,6 +72,7 @@ fi function xorg_d_configure_input() { # Keyboard configuration (Xorg >= 1.8 uses /etc/X11/xorg.conf.d) [ ! -e /etc/X11/xorg.conf.d/00-keyboard.conf ] && { + if [ ! "$XKB_MODEL" -o ! "$XKB_LAYOUT" ]; then case "${LANG:0:2}" in it) @@ -91,20 +92,30 @@ function xorg_d_configure_input() { XKB_LAYOUT="us" ;; esac fi - # configure keyboard options for Apple computers - if [ "${SYSTEM_MANUFACTURER:0:5}" = "Apple" ]; then - XKB_OPTIONS="$XKB_OPTIONS,lv3:rwin_switch" - fi - localectl set-x11-keymap $XKB_LAYOUT $XKB_MODEL $XKB_VARIANT $XKB_OPTIONS && { - 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 - } + + cat > /etc/X11/xorg.conf.d/00-keyboard.conf << __EOF +# Created by postplug +Section "InputClass" + Identifier "system-keyboard" + MatchIsKeyboard "on" + Option "XkbLayout" "$XKB_LAYOUT" +__EOF + [ "$XKB_MODEL" ] && echo " Option \"XkbModel\" \"$XKB_MODEL\"" >>/etc/X11/xorg.conf.d/00-keyboard.conf + [ "$XKB_VARIANT" ] && echo " Option \"XkbVariant\" \"$XKB_VARIANT\"" >>/etc/X11/xorg.conf.d/00-keyboard.conf + 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 ] && { cat > /etc/X11/xorg.conf.d/20-touchpad.conf << __EOF Section "InputClass" @@ -491,7 +502,6 @@ sed -i "/\W*Option \"Device\".*/d" $XORGCONF # remove obsoleted XAANoOffscreenPixmaps sed -i '/^[[:space:]]*Option[[:space:]]*"XAANoOffscreenPixmaps" "true"/d' $XORGCONF - # disable keyboard configuration for Xorg >= 1.4 sed -i "s|^\([[:space:]]*InputDevice\W*\"Keyboard0\".*\)|#\1|" $XORGCONF