From 49524f3ee29c0560656ada984e49b0a9643c75d7 Mon Sep 17 00:00:00 2001 From: Peng Huang Date: Sun, 13 Dec 2009 13:12:16 +0800 Subject: [PATCH] Add a script for get keycode in Xorg --- data/keymaps/keycode.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 data/keymaps/keycode.py diff --git a/data/keymaps/keycode.py b/data/keymaps/keycode.py new file mode 100755 index 0000000..d938f27 --- /dev/null +++ b/data/keymaps/keycode.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +import gtk + +def press_cb(window, e, label): + s = "keycode: %d, keysym: %s, keyval:%d ." % (e.hardware_keycode - 8, gtk.gdk.keyval_name(e.keyval), e.keyval) + label.set_text(s) + +def main(): + window = gtk.Window() + window.set_default_size(400, 100) + window.set_position(gtk.WIN_POS_CENTER_ALWAYS) + label = gtk.Label("Please make sure you are using evdev of xorg!\nPress some key.") + window.add(label) + + window.connect("delete-event", gtk.main_quit) + window.connect("key-press-event", press_cb, label) + + window.show_all() + gtk.main() + +if __name__ == "__main__": + main() -- 2.7.4