Previous Next Contents

15. Examples of use of loadkeys and xmodmap

Switching Caps Lock and Control on the keyboard (assuming you use keymaps 0-15; check with dumpkeys | head -1)

  % loadkeys
  keymaps 0-15
  keycode 58 = Control
  keycode 29 = Caps_Lock
  %
Switching them under X only:
  % xmodmap .xmodmaprc
where .xmodmaprc contains lines
  remove Lock = Caps_Lock
  remove Control =  Control_L
  keysym  Control_L  =  Caps_Lock
  keysym  Caps_Lock  = Control_L
  add Lock = Caps_Lock
  add Control = Control_L
What is this about the key numbering? Backspace is 14 under Linux, 22 under X? Well, the numbering can best be regarded as arbitrary; the Linux number of a key can be found using showkey(1), and the X number using xev(1). Often the X number will be 8 more than the Linux number.

15.1 `I can use only one finger to type with'

Can the Shift, Ctrl and Alt keys be made to behave as toggles?" Yes, after saying

% loadkeys
keycode 29 = Control_Lock
keycode 42 = Shift_Lock
keycode 56 = Alt_Lock
%
the left Control, Shift and Alt keys will act as toggles. The numbers involved are revealed by showkey (and usually are 29, 97, 42, 54, 56, 100 for left and right control, shift and alt, respectively), and the functions are Control_Lock, Shift_Lock, Alt_Lock, ALtGr_Lock.

What about `sticky' modifier keys? Well, since their introduction in the kernel (1.3.33) there has not been a new release of the kbd package yet, so they have to be invoked using their hexadecimal codes. For example,

% loadkeys
keymaps 0-15
keycode 54 = 0x0c00
keycode 97 = 0x0c02
keycode 100 = 0x0c03
%
will make the right Shift, Ctrl, Alt sticky versions of the left ones.


Previous Next Contents