xorg-x11-server/fedora-setup-keyboard
Adam Jackson 59994a9d39 * Mon Aug 04 2008 Adam Jackson <ajax@redhat.com> 1.4.99.906-3
- 10-x11-keymap.fdi, fedora-setup-keyboard: Attempt to read keyboard settings
  from /etc/sysconfig/keyboard and stuff them into hal.
2008-08-04 21:15:46 +00:00

34 lines
989 B
Bash

#!/bin/sh
#
# Trivial egregious hack to load the console keyboard layout into XKB.
#
# Yes, this should really just be written in python. If you can figure
# out how to make hal callouts written in python _work_, then please
# let me know. In the meantime, we'll do this.
[[ -x /usr/bin/python ]] || exit 0
[[ -x /usr/bin/hal-set-property ]] || exit 0
source /etc/sysconfig/keyboard >& /dev/null || exit 0
[[ -n "$KEYTABLE" ]] || exit 0
rhplquery () {
/usr/bin/python -c "import rhpl.keyboard_models; m = rhpl.keyboard_models.KeyboardModels().get_models(); print \"junk='%s' layout='%s' model='%s' variant='%s' options='%s'\" % tuple(m[\"$1\"])" || echo "exit 0"
}
eval `rhplquery $KEYTABLE`
hal_set () {
if [[ -n "${!1}" ]]; then
/usr/bin/hal-set-property --direct --udi "$UDI" --key input.xkb.$1 --string "${!1}"
else
/usr/bin/hal-set-property --direct --udi "$UDI" --key input.xkb.$1 --remove
fi
}
hal_set layout
hal_set model
hal_set variant
hal_set options