ACTION!="add|change", GOTO="xkb_end"
ENV{ID_INPUT_KEYBOARD}!="?*", GOTO="xkb_end"

IMPORT{cmdline}="xkeymap"

ENV{xkeymap}=="?*", PROGRAM="/bin/sh -c 'echo $env{xkeymap} | tr : \\t'", ENV{xkblayout}="%c{1}"
ENV{xkeymap}=="?*:?*", ENV{xkbvariant}="%c{2}"

ENV{xkeymap}=="?*", GOTO="xkb_end"

# If a cmdline option is not given, use the configuration
# snippet (/etc/X11/xorg.conf.d/00-configured-keymap.conf).
ENV{ID_INPUT.tags}="use_configured_keymap"

IMPORT{file}="/etc/env.d/03locale"
ENV{LANG}=="?*", PROGRAM="/bin/sh -c 'echo $${LANG,,} | tr .@_ \\t'", ENV{.language}="%c{1}", ENV{.territory}="%c{2}"

ENV{.language}=="ar", ENV{xkblayout}="ara"
ENV{.language}=="el", ENV{xkblayout}="gr"
ENV{.language}=="es", ENV{.territory}!="es", ENV{xkblayout}="latam"
ENV{.language}=="sr", ENV{xkblayout}="rs"
ENV{.language}=="tr", ENV{xkblayout}="tr"

# See Pardus Bugzilla #4271
ENV{.territory}=="nl", ENV{xkblayout}="us", ENV{xkbvariant}="intl"

ENV{.territory}=="?*", ENV{xkblayout}!="?*", ENV{xkblayout}="$env{.territory}"

LABEL="xkb_end"
