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() {
# 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