summaryrefslogtreecommitdiff
path: root/general/input/XKB-Config.xml
blob: 7dac34c64c4d909413c47afaf6d83be7cbcc3cb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
          "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
[
<!ENTITY % defs SYSTEM "defs.ent"> %defs;
]>

<article>

  <articleinfo>

    <title>The XKB Configuration Guide</title>
    <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
    <authorgroup>
      <author>
	<firstname>Kamil</firstname><surname>Toman</surname>
      </author>
      <author>
	<firstname>Ivan</firstname><othername>U.</othername>
	<surname>Pascal</surname>
      </author>
    </authorgroup>
    <pubdate>November 2010</pubdate>

    <abstract>

      <para>
This document describes how to configure Xorg XKB from a user's point
of view. It covers basic configuration syntax and gives also a few examples.
      </para>
      <para>
This version covers Xorg server versions 1.8 and later, used with the
data files from the <ulink
url="http://www.freedesktop.org/wiki/Software/XKeyboardConfig"
>xkeyboard-config</ulink> project.
      </para>

    </abstract>

  </articleinfo>

  <sect1>
    <title>Overview</title>

    <para>
The XKB configuration is decomposed into a number of components. Selecting
proper parts and combining them back you can achieve most of the configurations
you might need. Unless you have a completely atypical keyboard you really don't
need to touch any of the xkb configuration files.
    </para>

    <para>
Some desktop environments now provide integrated graphical configuration
tools for setting XKB configuration as part of your desktop session.  The
instructions in this document are provided for those without such support,
those who need to configure XKB before the session startup (such as at the
login screen), or those who need to perform more advanced configuration
than those tools provide.
    </para>

  </sect1>

  <sect1>
    <title>Selecting XKB Configuration</title>

    <para>
The easiest and the most natural way to specify a keyboard mapping is to use
the <literal remap="tt">rules</literal> component. As its name suggests it describes a number of
general rules to combine all bits and pieces into a valid and useful keyboard
mapping. All you need to do is to select a suitable rules file and then to
feed it with a few parameters that will adjust the keyboard behaviour to
fulfill your needs.
    </para>

    <para>
      The parameters are:

      <variablelist>
	<varlistentry>
	  <term><option>XkbRules</option></term>
	  <listitem><para>
files of rules to be used for keyboard mapping composition
	  </para></listitem>
	</varlistentry>

	<varlistentry>
	  <term><option>XkbModel</option></term>
	  <listitem><para>
 name of the model of your keyboard type
	  </para></listitem>
	</varlistentry>

	<varlistentry>
	  <term><option>XkbLayout</option></term>
	  <listitem><para>
 layout(s) you intend to use
	  </para></listitem>
	</varlistentry>

	<varlistentry>
	  <term><option>XkbVariant</option></term>
	  <listitem><para>
 variant(s) of the layout you intend to use
	  </para></listitem>
	</varlistentry>

	<varlistentry>
	  <term><option>XkbOptions</option></term>
	  <listitem><para>
 extra xkb configuration options
	  </para></listitem>
	</varlistentry>

      </variablelist>

    </para>

    <para>
The rules file used depends on your system.  The rules files commonly
used with Xorg are provided by the <ulink
url="http://www.freedesktop.org/wiki/Software/XKeyboardConfig"
>xkeyboard-config</ulink> project.
On Linux systems, the <filename>evdev</filename> rules are most
commonly used, on other systems the <filename>base</filename> rules
are used.  Some additional rules files exist for historical reasons,
but are no longer widely used.  In general, it's best to simply not
specify the rules file, in order to use the default rules selected
automatically by the X server.
    </para>
    <para>
For each rules file there is a description file named
<filename>&lt;<replaceable>vendor-rules</replaceable>&gt;.lst</filename>,
for instance <filename>base.lst</filename> which is located in
the xkb configuration subdirectory <filename>rules</filename>
(for example <filename>/usr/share/X11/xkb/rules</filename>).
    </para>

    <sect2>
      <title>Basic Configuration</title>

      <para>
Let's say you want to configure a PC-style American keyboard with 104
keys as described in <filename>base.lst</filename>.  This can be done
by simply writing several lines from below to a new configuration file
in <filename>/etc/X11/xorg.conf.d</filename>, such
as <filename>/etc/X11/xorg.conf.d/90-custom-kbd.conf</filename>.


	<screen>
Section "InputClass"
    Identifier "keyboard defaults"
    MatchIsKeyboard "on"

    Option "XkbModel" "pc104"
    Option "XkbLayout" "us"
    Option "XKbOptions" ""
EndSection
	</screen>

The values of <option>XkbModel</option> and <option>XkbLayout</option> are
really not surprising. The <option>XkbOptions</option>
has been explicitly set to the empty set of parameters.
The <option>XkbVariant</option> option has been left out.
That means the default variant named <literal remap="tt">basic</literal>
is loaded.
      </para>

      <para>
Of course, this can be also done at runtime using the utility
<command>setxkbmap</command>.
The shell command loading the same keyboard mapping would look like:

	<screen>
setxkbmap -model pc104 -layout us -option ""
	</screen>

The configuration and the shell command would be very analogous
for most other layouts (internationalized mappings).
      </para>

      <para id="zap">
If you wanted to enable the <keycombo action='simul'><keycap>Ctrl</keycap>
<keycap>Alt</keycap><keycap>Backspace</keycap></keycombo> sequence to kill
the X server by default, you could create a configuration snippet
<filename>/etc/X11/xorg.conf.d/90-zap.conf</filename> containing:

	<screen>
Section "InputClass"
    Identifier "keyboard defaults"
    MatchIsKeyboard "on"

    Option "XKbOptions" "terminate:ctrl_alt_bksp"
EndSection
	</screen>

This would be equivalent to running the shell command:

	<screen>
setxkbmap -option "terminate:ctrl_alt_bksp"
	</screen>
      </para>

    </sect2>

    <sect2>
      <title>Advanced Configuration</title>

      <para>
You can use multi-layouts xkb configuration.
What does it mean? Basically it allows to load up to four different
keyboard layouts at a time. Each such layout would reside in its
own group. The groups (unlike complete keyboard remapping) can be
switched very fast from one to another by a combination of keys.
      </para>

      <para>
Let's say you want to configure your new Logitech cordless desktop
keyboard, you intend to use three different layouts at the same
time - us, czech and german (in this order), and that you are used to
<keycombo action='simul'><keycap>Alt</keycap><keycap>Shift</keycap></keycombo>
combination for switching among them.
      </para>

      <para>
Then the configuration snippet could look like this:

	<screen>
Section "InputClass"
    Identifier "Logitech Cordless"
    MatchIsKeyboard   "on"

    Option "XkbModel" "logicordless"
    Option "XkbLayout" "us,cz,de"
    Option "XKbOptions" "grp:alt_shift_toggle"
EndSection
	</screen>

Of course, this can be also done at runtime using the utility
<command>setxkbmap</command>.
The shell command loading the same keyboard mapping would look like:

	<screen>
setxkbmap -model logicordless -layout "us,cz,de" \
         -option "grp:alt_shift_toggle"
	</screen>

      </para>

    </sect2>

    <sect2>
      <title>Even More Advanced Configuration</title>

      <para>
Okay, let's say you are more demanding. You do like the example
above but you want it to change a bit. Let's imagine you want
the czech keyboard mapping to use another variant but basic.
The configuration snippet then changes into:

	<screen>
Section "InputClass"
    Identifier "Logitech Cordless"
    MatchIsKeyboard   "on"

    Option "XkbModel" "logicordless"
    Option "XkbLayout" "us,cz,de"
    Option "XkbVariant" ",bksl,"
    Option "XKbOptions" "grp:alt_shift_toggle"
EndSection
	</screen>

That seems tricky but it is not. The logic for settings of variants
is the same as for layouts, that means the first and the third variant
settings are left out (set to <literal remap="tt">basic</literal>),
the second is set to <literal remap="tt">bksl</literal> (a special
variant with an enhanced definition of the backslash key).
      </para>

      <para>
Analogously, the loading runtime will change to:

	<screen>
setxkbmap -model logicordless -layout "us,cz,de" \
         -variant ",bksl," -option "grp:alt_shift_toggle"
	</screen>

      </para>

    </sect2>

    <sect2>
      <title>Basic Global Options</title>

      <para>
For a list of available options, with a short decription of what they do,
see the section starting with <quote><literal>! option</literal></quote> in the
<filename>rules/*.lst</filename> files.
      </para>

<!--
  TODO: More detailed descriptions of options. Users often get confused.
-->

    </sect2>

  </sect1>

  <sect1>
    <title>Keymap XKB Configuration</title>

    <para>
Keymap configuration is the way formerly used to configure xkb. The
user included a special keymap file which specified the direct xkb
configuration. This method has been obsoleted by previously described
rules files which are far more flexible and allow simpler and more
intuitive syntax. It is preserved merely for compatibility reasons and
should be avoided if possible.
    </para>

  </sect1>

</article>