Keyboard's keys under X window.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Wed, 25 Apr 2012 16:57:51 +0300
changeset 1256 7ce42ae5477d
parent 1255 7cad4e6d59cd
child 1257 a0939a5f4042
Keyboard's keys under X window.
x.rst
--- a/x.rst	Wed Apr 25 15:22:28 2012 +0300
+++ b/x.rst	Wed Apr 25 16:57:51 2012 +0300
@@ -76,13 +76,69 @@
   $ xprop -root
   $ xprop -name bash    # for xterm with running bash inside
 
+Keyboard's keys under X window.
+===============================
+
+  scancodes
+                hardware-dependent codes generated by keystrokes and received by
+                the X server.
+  keycodes
+                Codes sent by the X server to the client indicating which key
+                was pressed. Keycodes by themselves do not indicate what the
+                keystroke means; the client must request that information from
+                the X server.
+  modifiers
+                Flags, such as ``shift'' and ``control,'' that the server sends
+                with each keycode to the client. The client's interpretation of
+                the keycode may depend on the state of the modifiers. For
+                example, the state of the shift modifier determines whether an
+                alphabetic character should be lowercase or uppercase. Because
+                the X server encodes the states of the eight modifiers (shift,
+                lock, control, mod1, mod2, mod3, mod4, and mod5) in a single
+                byte of data, modifiers are often referred to as ``modifier
+                bits.''
+  keysyms
+                codes that specify the glyphs appearing on the keys. The X
+                server also maintains a list of strings that describe the
+                keysyms, such as ``a'', ``B'', and ``Control.''
+
 Find the keycode.
 =================
+
 ::
 
   $ xev
   $ cat /usr/include/X11/keysymdef.h
 
+Don't run under X::
+
+  $ showkey
+
+To do same under X::
+
+  $ xev | sed -n 's=.*keycode \([0-9]*\).*=\1=p'
+
+List key modifier::
+
+  $ xmodmap -pm
+
+Add keycode to modifier::
+
+  $ xmodmap -e "add shift = Shift_R
+
+Remove keycode from modifier::
+
+  $ xmodmap -e "remove shift = Shift_L"
+
+Examining the current keymap table::
+
+  $ xmodmap -pk
+
+  https://wiki.ubuntu.com/LaptopTesting/Keycodes
+                Ubuntu Keycodes howto.
+  http://en.gentoo-wiki.com/wiki/Multimedia_Keys
+                Gentoo Multimedia Keys howto.
+
 Making screenshort.
 ===================
 ::