Difference between revisions of "Keyboard configuration in console"

From ArchWiki
Jump to: navigation, search
m (added ja)
(update link(s) (avoid redirect))
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Category:Keyboards]]
 
[[Category:Keyboards]]
 +
[[es:Keyboard Configuration in Console]]
 
[[ja:Keyboard Configuration in Console]]
 
[[ja:Keyboard Configuration in Console]]
 
[[zh-CN:Keyboard Configuration in Console]]
 
[[zh-CN:Keyboard Configuration in Console]]
{{Article summary start}}
+
{{Related articles start}}
{{Article summary text|Basic configuration of keyboard layouts in [[Wikipedia:Virtual console|virtual console]].}}
+
{{Related|Keyboard configuration in Xorg}}
{{Article summary heading|Related}}
+
{{Related|Extra Keyboard Keys}}
{{Article summary wiki|Keyboard Configuration in Xorg}}
+
{{Related articles end}}
{{Article summary wiki|Extra Keyboard Keys}}
+
{{Article summary end}}
+
  
 
{{Note|This article covers only basic configuration without modifying layouts, mapping extra keys etc. See [[Extra Keyboard Keys]] for these advanced topics.}}
 
{{Note|This article covers only basic configuration without modifying layouts, mapping extra keys etc. See [[Extra Keyboard Keys]] for these advanced topics.}}

Revision as of 20:56, 27 March 2014

Note: This article covers only basic configuration without modifying layouts, mapping extra keys etc. See Extra Keyboard Keys for these advanced topics.

Keyboard mappings (keymaps) for virtual console, console fonts and console maps are provided by the kbd package (it should already be installed), which also provides many low-level tools for managing virtual console.

Viewing keyboard settings

You can use the following command to view keyboard configuration:

$ localectl status
   System Locale: LANG=en_GB.utf8
                  LC_COLLATE=C
       VC Keymap: cz-qwertz
      X11 Layout: cz

Setting keyboard layout

Unlike XKB keyboard layout, which is composed of multiple components, the keyboard layout for virtual console has only one component. Usually one keymap file corresponds to one keyboard layout (the include statement can be used to share common parts and a keymap file can contain multiple layouts with some key combination used for switching). The keymap files are stored in /usr/share/kbd/keymaps/ directory tree. You can use the following command to list all available keymaps:

$ localectl list-keymaps

The naming conventions of console keymaps are not very strict, but usually the name consists of a 2-letter country code and a variant, separated by slash (-) or underscore (_).

Persistent configuration

High-level configuration can be done in /etc/vconsole.conf, which is read by systemd on start-up. The KEYMAP variable is used for specifying keymap. If the variable is empty or not set, the us keymap is used as default value. See man 5 vconsole.conf for all options. For example:

/etc/vconsole.conf
KEYMAP=cz-qwertz
...

For convenience, localectl may be used to set console keymap. It will change the KEYMAP variable in /etc/vconsole.conf and set the keymap for current session. For example:

$ localectl set-keymap --no-convert keymap

See man 1 localectl for details.

Temporary configuration

Of course it is possible to set a keymap just for current session. This is useful for testing different keymaps, solving problems etc.

The loadkeys tool is used for this purpose, it is used internally by systemd when loading the keymap configured in /etc/vconsole.conf. It can be used very simply for this purpose:

# loadkeys keymap

See man 1 loadkeys details.

Other settings

Changing console font

The kbd package provides tools to change virtual console font and font mapping. The fonts are saved in /usr/share/kbd/consolefonts/ directory.

The configuration is done in vconsole.conf using the FONT and FONT_MAP variables:

/etc/vconsole.conf
...
FONT=Lat2-Terminus16
FONT_MAP=8859-2

If the FONT variable is empty or not set, the kernel built-in font is used as default. See man 5 vconsole.conf for details.

Adjusting typematic delay and rate

The typematic delay indicates the amount of time (typically in miliseconds) a key needs to be pressed in order for the repeating process to begin. After the repeating process has been triggered, the character will be repeated with a certain frequency (usually given in Hz) specified by the typematic rate. These values can be changed using the kbdrate command:

# kbdrate [-d delay] [-r rate]

For example to set a typematic delay to 200ms and a typematic rate to 30Hz, use the following command:

# kbdrate -d 200 -r 30

Issuing the command without specifying the delay and rate will reset the typematic values to their respective defaults; a delay of 250ms and a rate of 11Hz:

# kbdrate