Jump to content

X keyboard extension: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Heycam (talk | contribs)
Rescuing 1 sources and tagging 0 as dead.) #IABot (v2.0.9.5) (Whoop whoop pull up - 21816
 
(55 intermediate revisions by 36 users not shown)
Line 1: Line 1:
{{Infobox software
In the [[X Window System]], the '''X keyboard extension''' or '''XKB''' extends the ability to control the [[computer keyboard|keyboard]] over what is offered by the [[X Window core protocol]]. The main features of this extension are:
|name = X keyboard extension
|logo =
|screenshot =
|caption =
|collapsible =
|author = [[X.Org Foundation]]
|developer =
|released = <!-- {{Start date|YYYY|MM|DD}} -->
|latest release version = 1.0
|latest release date = {{Start date and age|1996}}
|latest preview version =
|latest preview date = <!-- {{Start date and age|YYYY|MM|DD}} -->
|frequently updated =
|programming language =
|operating system =
|platform =
|size =
|language =
|status =
|genre =
|license =
|website =
}}


In [[human–computer interface]]s, the '''X keyboard extension''' or '''XKB''' is a part of the [[X Window System]] that extends the ability to control the [[computer keyboard|keyboard]] over what is offered by the [[X Window System core protocol]], and allows to use multiple [[keyboard layout|keyboard layouts]].
* enhanced support for [[modifier key|modifier]]s;

* better treatment of [[key group]]s;
Its main features are:
* enhanced support for ''[[modifier key|modifier]]s'' ({{key press|[[Alt key|Alt]]}}, {{key press|[[Shift key|Shift]]}}, etc.);
* better treatment of ''key groups'' (typically [[keyboard layout|keyboard layouts]]);
* extended control of keyboard indicators ([[LED]]s) and [[bell character|bell]]s;
* extended control of keyboard indicators ([[LED]]s) and [[bell character|bell]]s;
* various new keyboard parameters (controls);
* various new keyboard parameters (controls);
* association of actions (of a particular kind) to keys;
* association of actions (of a particular kind) to keys.

XKB is composed of two parts: a server extension and a client library. Modern versions of [[Xlib]] contain XKB, which is active by default. Client programs not using this extension can deactivate it before connecting with the server, or can simply work normally as the extension simulates the core protocol by default.

XKB is also used by [[Wayland compositor]]s and [[kmscon]].

== Latched and locked modifiers ==


XKB allows a modifier to be ''locked'' or ''latched'', other than being in its regular state. Normally, a modifier is active exactly when it is pressed, like the [[Shift key|Shift]]. However, a modifier may also be locked, like the [[Caps Lock]] modifier. When a modifier is locked, it remains active until it is explicitly deactivated. An intermediate condition between regular and locked is the latched state: When a modifier is latched, it remains active, but only until the next non-modifier key is pressed.
The extension is composed of two parts: a server extension and a client library. Modern versions of [[Xlib]] contain the keyboard extension, which is active by default. Client programs not using this extension can deactivate it before connecting with the server, or can simply work normally as the extension simulates the core protocol by default.


XKB allows a client application to explicitly latch or lock a modifier. Moreover, an application can bind a key press or release to a modifier state change. This way, a modifier may automatically become latched or locked whenever a key is pressed or released.
==Latched and locked modifiers==


== Key groups ==
The X keyboard extension allows a modifier to be ''locked'' or ''latched'', other than being in its regular state. Normally, a modifier is active exactly when it is pressed, like the [[Shift]]. However, a modifier may also be locked, like the [[CapsLock]] modifier. In particular, when a modifier is locked it remains active until it is explicitly deactivated. An intermediate condition between regular and locked is the latched state: when a modifier is latched it remains active, but only until the next non-modifier key is pressed.


XKB allows for the keyboard to switch between any of four different character groups. This is usually done for making a keyboard behave like a keyboard of a different language. In this context, the set of characters that is generated by the keyboard is called a ''group'', and a keyboard can switch to a different group at any time.
The keyboard extension allows a client application to explicitely latch or lock a modifier. Moreover, an application can bound a key press or release to a change of state of a modifier. This way, a modifier may automatically become latched or locked whenever a key is pressed or released.


XKB defines some ''group selectors'' (which are simply called ''groups'' in the specification). As with modifiers, a group selector can be associated with a key, but can also be latched or locked.
==Key groups==


== Controls ==
The X keyboard extension allows for the keyboard to switch between different character groups. This is usually done for making a keyboard behave like a keyboard of a different language. In this context, the set of characters that are generated by the keyboard are called a ''group'', and a keyboard can switch to a different group at any time.


The behavior of the keyboard depends on a number of parameters that can be changed by the clients. These parameters are called ''controls''. For example, the ''SlowKey'' control can be used to ignore short keypresses. Another control is the ''MouseKeys'', which makes some keypresses to simulate mouse movements. The control only indicates whether this simulation is active or not; which keys produce the movement is not considered a part of the control, but is specified by attaching actions to these keys.
Like for modifier, the X keyboard extension define some group selectors (called simply group in the specification). Like for modifiers, a group selector can be associated to a key, but can also be latched or locked.


The above two controls are [[Boolean data type|Boolean]]: they are either active or not. The ''PerKeyRepeat'' is a control that is not Boolean. Namely, it is a mask that says which keys are in autorepeat mode. According to the specification, non-Boolean controls are "always active": that means that they always depends on a set of parameters (in this case, the mask), but that there is no single bit that can be used to deactivate the effects of the control completely.
==Controls==


Other than being Boolean or non-Boolean, controls also classifies as affecting the behavior of the server and affecting the behavior of the client library. The two above are server controls. Client library controls affect the translation of a keycode or a sequence of keycodes into a string (''XLookupString'') and event delivery.
The behaviour of the keyboard depends on a number of parameters that can be changed by the clients. These parameters are called ''controls''. For example, the SlowKey control can be used to ignore short keypresses. Another control is the MouseKeys, which makes some keypresses to simulate mouse movements. The control only indicates whether this simulation is active or not; which keys produce the movement is not considered a part of the control, but is specified by attaching actions to these keys.


== Actions ==
The above two controls are boolean: they are either active or not. The PerKeyRepeat is a control that is not boolean. Namely, it is a mask that says which keys are in autorepeat mode. According to the specification, non-boolean controls are "always active": that means that they always depends on a set of parameters (in this case, the mask), but that there is no single bit that can be used to deactivate the effects of the control completely.


XKB allows for associating actions with key presses, which moves some of the burden of input event processing from client applications to the X server. However, the actions that can be associated with keys are limited to the following:
Other than being Boolean or non-Boolean, controls also classifies as affecting the behavior of the server and affecting the bahvior of the client library. The two above are server controls. Client library controls affect the translation of a keycode or a sequence of keycodes into a string (XLookupString) and event delivery.
# Change the state of a modifier, making it active, inactive, latched or locked
# Change the state of the group selectors (same as modifiers)
# Simulate a mouse event (movement or button activity)
# Change the active screen (this kind of action is optional, that is, not necessarily supported by the server)
# Change the state of Boolean controls
# Generate a message event (that is, a packet that is sent to the client)
# Generate a different keycode
Moreover, there are some actions related to devices that are available if the server supports the [[X Input extension]].


== Compatibility problems ==
==Actions==


The X keyboard extension is incompatible with core keyboard handling and as a result several modifier keys are not working or require workarounds inside emulated environments such as VNC or [[Xephyr]].
The keyboard extension allows for associating some actions to key presses. This partly solve the problem of the X Window System that any input activity noticed by the server has to be reported to the client, which decides the correct action to take. The actions that can be associated to keys are however limited to the following ones:


== Other ==
# change the state of a modifier, making it active, deactive, latched or locked
# change the state of the group selectors (same as modifiers)
# simulate a mouse mouse event (movement or button activity)
# change the active screen (this kind of action is optional, that is, not necessarily supported by the server)
# change the state of boolean controls
# generate a message event (that is, a packet that is sent to the client)
# generate a different keycode


XKB allows better handling of the [[keyboard indicator]]s (LEDs). In particular, XKB provides symbolic names for indicators, which allows binding indicators to keyboard activity and checking which indicators are actually present on the keyboard.
Moreover, there are some actions related to devices, if the server supports the X Input extension.


XKB also improves upon the [[X Window System core protocol|core protocol's]] handling of ''bells''; the core protocol only supports one bell, and the only action a client can perform is to ring the bell. XKB supports multiple named bells and allows a client to deactivate some of them and to be informed when a bell is rung.
==Other==


XKB allows a client to query the physical shape of the keyboard, including the shapes of individual keys. In particular, keys are arranged into sections, possibly rotated (as an example, the numeric keypad is typically considered a section). Within a section, keys are arranged into rows. Keys and sections have a geometry, which comprise the approximate outline of the key, its [[bounding box]], and the precise form. Other than keys, the geometry also includes ''doodads'', which are elements on the keyboard that are not keys. The overall shape of the keyboard is a doodad. Information provided about doodads includes their color and any text printed on them (including the font used).
The keyboard extension allows for a better handling of keyboard indicators (LEDs). In particular, XKB provides symbolic names for indicators, allows bounding them to keyboard activity, and allows checking which leds are actually present on the keyboard.


== References ==
The keyboard extension also improves over the core protocol on the handling of bells. The core protocol only supports one bell and the only action a client can perform is to ring the bell. XKB supports multiple named bells and allows a client to deactivate some of them and being informed of when a bell is rung.


{{Reflist}}
One of the feature of this extension is that a client can ask the server what is the physical shape of the keyboard and of the individual keys. In particular, keys are arranged into sections, possibly rotated (as an example, the numeric keypad is typically considered a section). Within a section, keys are arranged into rows. Keys and sections have a geometry, which comprise the approximate outline of the key, its bounding box, and the precise form. Other than keys, the geometry also includes doodads, which are elements on the keyboard that are not keys. The overall shape of the keyboard is a doodad. Other doodads are, I presume, the leds. Other information about doodads are their color, the text printed on them (if any) and its font.
* X Consortium Inc. ''The X keyboard extension: library specification'' (1996). [http://www.x.org/releases/current/doc/libX11/XKB/xkblib.html HTML], [https://www.x.org/releases/current/doc/libX11/XKB/xkblib.pdf PDF].
* X Consortium Inc. ''The X keyboard extension: protocol specification'' (1996). [http://www.x.org/releases/current/doc/kbproto/xkbproto.html HTML], [https://www.x.org/releases/current/doc/kbproto/xkbproto.pdf PDF].
* X Consortium Inc. ''The XKB configuration guide'' (2010) [http://www.x.org/releases/current/doc/xorg-docs/input/XKB-Config.html HTML], [https://www.x.org/releases/current/doc/xorg-docs/input/XKB-Config.pdf PDF].
* X Consortium Inc. ''How to further enhance XKB configuration'' (2002). [http://www.x.org/releases/current/doc/xorg-docs/input/XKB-Enhancing.html HTML], [https://www.x.org/releases/current/doc/xorg-docs/input/XKB-Enhancing.pdf PDF].


== External links ==
==References==


;On XKB
* [http://www.xfree86.org/current/XKBlib.pdf The X Keyboard Extension: Library Specification]
* [https://wiki.archlinux.org/index.php/X_keyboard_extension ArchWiki. X keyboard extension]
* [http://www.xfree86.org/current/XKBproto.pdf The X Keyboard Extension: Protocol Specification]
* [https://medium.com/@damko/a-simple-humble-but-comprehensive-guide-to-xkb-for-linux-6f1ad5e13450 Damiano Venturin. A simple, humble but comprehensive guide to XKB for linux (2016)]
* [http://hektor.umcs.lublin.pl/~mikosmul/computing/articles/custom-keyboard-layouts-xkb.html Michal Kosmulski. Creating custom keyboard layouts for X11 using XKB (2011)] {{Webarchive|url=https://web.archive.org/web/20120204082551/http://hektor.umcs.lublin.pl/~mikosmul/computing/articles/custom-keyboard-layouts-xkb.html |date=2012-02-04 }}
* [https://web.archive.org/web/20190319193206/http://pascal.tsu.ru/en/xkb Ivan Pascal. X keyboard extension] — Detailed information on the various XKB Configuration files.
* [http://www.charvolant.org/doug/xkb/html/xkb.html Doug Palmer. An unreliable guide to XKB configuration (2004)]


{{XWinSys}}
==External links==
* [http://hektor.umcs.lublin.pl/~mikosmul/computing/articles/custom-keyboard-layouts-xkb.html Creating custom keyboard layouts for X11 using XKB]


[[Category:X Window System]]
[[Category:X Window extensions]]
[[Category:X Window extensions]]
[[Category:Wayland extensions]]

Latest revision as of 18:21, 19 November 2024

X keyboard extension
Original author(s)X.Org Foundation
Stable release
1.0 / 1996; 28 years ago (1996)
Websitewww.x.org/wiki/XKB/ Edit this on Wikidata

In human–computer interfaces, the X keyboard extension or XKB is a part of the X Window System that extends the ability to control the keyboard over what is offered by the X Window System core protocol, and allows to use multiple keyboard layouts.

Its main features are:

  • enhanced support for modifiers (Alt, Shift, etc.);
  • better treatment of key groups (typically keyboard layouts);
  • extended control of keyboard indicators (LEDs) and bells;
  • various new keyboard parameters (controls);
  • association of actions (of a particular kind) to keys.

XKB is composed of two parts: a server extension and a client library. Modern versions of Xlib contain XKB, which is active by default. Client programs not using this extension can deactivate it before connecting with the server, or can simply work normally as the extension simulates the core protocol by default.

XKB is also used by Wayland compositors and kmscon.

Latched and locked modifiers

[edit]

XKB allows a modifier to be locked or latched, other than being in its regular state. Normally, a modifier is active exactly when it is pressed, like the Shift. However, a modifier may also be locked, like the Caps Lock modifier. When a modifier is locked, it remains active until it is explicitly deactivated. An intermediate condition between regular and locked is the latched state: When a modifier is latched, it remains active, but only until the next non-modifier key is pressed.

XKB allows a client application to explicitly latch or lock a modifier. Moreover, an application can bind a key press or release to a modifier state change. This way, a modifier may automatically become latched or locked whenever a key is pressed or released.

Key groups

[edit]

XKB allows for the keyboard to switch between any of four different character groups. This is usually done for making a keyboard behave like a keyboard of a different language. In this context, the set of characters that is generated by the keyboard is called a group, and a keyboard can switch to a different group at any time.

XKB defines some group selectors (which are simply called groups in the specification). As with modifiers, a group selector can be associated with a key, but can also be latched or locked.

Controls

[edit]

The behavior of the keyboard depends on a number of parameters that can be changed by the clients. These parameters are called controls. For example, the SlowKey control can be used to ignore short keypresses. Another control is the MouseKeys, which makes some keypresses to simulate mouse movements. The control only indicates whether this simulation is active or not; which keys produce the movement is not considered a part of the control, but is specified by attaching actions to these keys.

The above two controls are Boolean: they are either active or not. The PerKeyRepeat is a control that is not Boolean. Namely, it is a mask that says which keys are in autorepeat mode. According to the specification, non-Boolean controls are "always active": that means that they always depends on a set of parameters (in this case, the mask), but that there is no single bit that can be used to deactivate the effects of the control completely.

Other than being Boolean or non-Boolean, controls also classifies as affecting the behavior of the server and affecting the behavior of the client library. The two above are server controls. Client library controls affect the translation of a keycode or a sequence of keycodes into a string (XLookupString) and event delivery.

Actions

[edit]

XKB allows for associating actions with key presses, which moves some of the burden of input event processing from client applications to the X server. However, the actions that can be associated with keys are limited to the following:

  1. Change the state of a modifier, making it active, inactive, latched or locked
  2. Change the state of the group selectors (same as modifiers)
  3. Simulate a mouse event (movement or button activity)
  4. Change the active screen (this kind of action is optional, that is, not necessarily supported by the server)
  5. Change the state of Boolean controls
  6. Generate a message event (that is, a packet that is sent to the client)
  7. Generate a different keycode

Moreover, there are some actions related to devices that are available if the server supports the X Input extension.

Compatibility problems

[edit]

The X keyboard extension is incompatible with core keyboard handling and as a result several modifier keys are not working or require workarounds inside emulated environments such as VNC or Xephyr.

Other

[edit]

XKB allows better handling of the keyboard indicators (LEDs). In particular, XKB provides symbolic names for indicators, which allows binding indicators to keyboard activity and checking which indicators are actually present on the keyboard.

XKB also improves upon the core protocol's handling of bells; the core protocol only supports one bell, and the only action a client can perform is to ring the bell. XKB supports multiple named bells and allows a client to deactivate some of them and to be informed when a bell is rung.

XKB allows a client to query the physical shape of the keyboard, including the shapes of individual keys. In particular, keys are arranged into sections, possibly rotated (as an example, the numeric keypad is typically considered a section). Within a section, keys are arranged into rows. Keys and sections have a geometry, which comprise the approximate outline of the key, its bounding box, and the precise form. Other than keys, the geometry also includes doodads, which are elements on the keyboard that are not keys. The overall shape of the keyboard is a doodad. Information provided about doodads includes their color and any text printed on them (including the font used).

References

[edit]
  • X Consortium Inc. The X keyboard extension: library specification (1996). HTML, PDF.
  • X Consortium Inc. The X keyboard extension: protocol specification (1996). HTML, PDF.
  • X Consortium Inc. The XKB configuration guide (2010) HTML, PDF.
  • X Consortium Inc. How to further enhance XKB configuration (2002). HTML, PDF.
[edit]
On XKB