#!/bin/sh
# partial port of livecd-setlocale (xkb bits)

PREFIX=/etc/X11/xorg.conf.d

# Requires: xorg-server-common
if [ ! -d "$PREFIX" ]; then
	echo "** l10n-xkb: expected $PREFIX to exist (xorg-server-common)" >&2
	exit 0
fi

if [ -z "$GLOBAL_XKB_KEYMAPS" ]; then
	echo "** l10n-xkb: empty GLOBAL_XKB_KEYMAPS" >&2
	exit 0
fi

cat > "$PREFIX/00-keyboard.conf" << EOF
Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
	Option "XkbLayout" "$GLOBAL_XKB_KEYMAPS"
	Option "XkbOptions" "$GLOBAL_XKB_SWITCH"
EndSection
EOF
