x.rst
changeset 1264 6fccb9f7cfd8
parent 1258 5e458103accb
child 1267 d2a8da11f9d7
--- a/x.rst	Wed Apr 25 21:32:32 2012 +0300
+++ b/x.rst	Wed Apr 25 21:32:45 2012 +0300
@@ -76,6 +76,74 @@
   $ 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
+
+Changing the keymap table::
+
+  $ xmodmap -e "keycode 34 = bracketleft braceleft"
+  $ xmodmap -e "keysym CapsLock = Control_L"
+
+  https://wiki.ubuntu.com/LaptopTesting/Keycodes
+                Ubuntu Keycodes howto.
+  http://en.gentoo-wiki.com/wiki/Multimedia_Keys
+                Gentoo Multimedia Keys howto.
+
 Making screenshort.
 ===================
 ::