* Tue Jan 27 2009 Peter Hutterer <peter.hutterer@redhat.com> 1.5.99.901-5
- replace fedora-setup-keyboard with pure python one (#478431)
This commit is contained in:
parent
6f00a812c2
commit
c28ddfe898
@ -1,33 +1,48 @@
|
|||||||
#!/bin/sh
|
#!/usr/bin/env python
|
||||||
#
|
# encoding: utf-8
|
||||||
# Trivial egregious hack to load the console keyboard layout into XKB.
|
# vim: tabstop=4 expandtab autoindent shiftwidth=4 fileencoding=utf-8
|
||||||
#
|
"""
|
||||||
# Yes, this should really just be written in python. If you can figure
|
fedora-setup-keyboard.py
|
||||||
# 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
|
Written by Alexander D. Kanevskiy <kad@blackcatlinux.com>
|
||||||
[[ -x /usr/bin/hal-set-property ]] || exit 0
|
"""
|
||||||
|
|
||||||
source /etc/sysconfig/keyboard >& /dev/null || exit 0
|
import sys, os, dbus
|
||||||
|
import rhpl.keyboard_models
|
||||||
|
from rhpl.simpleconfig import SimpleConfigFile
|
||||||
|
|
||||||
[[ -n "$KEYTABLE" ]] || exit 0
|
KBDCONFIG = "/etc/sysconfig/keyboard"
|
||||||
|
|
||||||
rhplquery () {
|
def main():
|
||||||
/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"
|
# Sanity checks
|
||||||
}
|
if 'UDI' not in os.environ:
|
||||||
|
sys.exit(1)
|
||||||
|
if not os.access(KBDCONFIG, os.R_OK):
|
||||||
|
sys.exit(0)
|
||||||
|
# Read config
|
||||||
|
kbd_config = SimpleConfigFile()
|
||||||
|
kbd_config.read(KBDCONFIG)
|
||||||
|
kbd_models = rhpl.keyboard_models.KeyboardModels().get_models()
|
||||||
|
(layout, model, variant, options) = tuple(kbd_models.get(kbd_config.info.get('KEYTABLE',''), ['', '', '', '', ''])[1:])
|
||||||
|
result_dict = { 'layout': layout, 'model': model, 'variant': variant, 'options': options }
|
||||||
|
|
||||||
|
# Now let's dbus fun begin
|
||||||
|
if 'HALD_DIRECT_ADDR' in os.environ:
|
||||||
|
bus = dbus.connection.Connection(os.environ['HALD_DIRECT_ADDR'])
|
||||||
|
else:
|
||||||
|
bus = dbus.SystemBus()
|
||||||
|
kbd = dbus.Interface(bus.get_object("org.freedesktop.Hal", os.environ['UDI']), 'org.freedesktop.Hal.Device')
|
||||||
|
for key in result_dict:
|
||||||
|
# Respect user settings
|
||||||
|
value = kbd_config.info.get(key.upper(), result_dict[key])
|
||||||
|
if not value:
|
||||||
|
try:
|
||||||
|
kbd.RemoveProperty("input.xkb.%s" % key)
|
||||||
|
except dbus.exceptions.DBusException:
|
||||||
|
pass # key already not exist
|
||||||
|
else:
|
||||||
|
kbd.SetPropertyString("input.xkb.%s" % key, value)
|
||||||
|
|
||||||
eval `rhplquery $KEYTABLE`
|
|
||||||
|
|
||||||
hal_set () {
|
if __name__ == '__main__':
|
||||||
if [[ -n "${!1}" ]]; then
|
main()
|
||||||
/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
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
Summary: X.Org X11 X server
|
Summary: X.Org X11 X server
|
||||||
Name: xorg-x11-server
|
Name: xorg-x11-server
|
||||||
Version: 1.5.99.901
|
Version: 1.5.99.901
|
||||||
Release: 4%{?dist}
|
Release: 5%{?dist}
|
||||||
URL: http://www.x.org
|
URL: http://www.x.org
|
||||||
License: MIT
|
License: MIT
|
||||||
Group: User Interface/X
|
Group: User Interface/X
|
||||||
@ -494,6 +494,9 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jan 27 2009 Peter Hutterer <peter.hutterer@redhat.com> 1.5.99.901-5
|
||||||
|
- replace fedora-setup-keyboard with pure python one (#478431)
|
||||||
|
|
||||||
* Tue Jan 27 2009 Dave Airlie <airlied@redhat.com> 1.5.99.901-4
|
* Tue Jan 27 2009 Dave Airlie <airlied@redhat.com> 1.5.99.901-4
|
||||||
- xserver-1.5.99.3-fix-core-fonts.patch (#478999)
|
- xserver-1.5.99.3-fix-core-fonts.patch (#478999)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user