GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing wiki.archlinux.org — Linux console/Keyboard configuration - ArchWiki (Redirected from Console keymap) Related articles Keyboard mappings, console fonts and console maps are provided by the kbd package (a dependency of systemd), which also provides low-level tools for managing the text console. In addition, systemd provides the localectl(1) tool, which can control both the system locale and keyboard layout settings for both the console and Xorg. Viewing keyboard settingsUse KeymapsThe keymap files are stored in the The For more details see keymaps(5). Listing keymapsThe naming conventions of console keymaps are somewhat arbitrary, but usually they are based on:
For a list of all the available keymaps, use the command: $ localectl list-keymaps To search for a keymap, use the following command, replacing $ localectl list-keymaps | grep -i search_term Alternatively, using find: $ find /usr/share/kbd/keymaps/ -type f -name "*search_term*" LoadkeysIt is possible to set a keymap just for the current session. This is useful for testing different keymaps, solving problems etc. The loadkeys tool is used for this purpose: # loadkeys keymap See loadkeys(1) for details. The same tool is used internally by systemd-vconsole-setup(8) when loading the keymap configured in Persistent configurationA persistent keymap can be set in /etc/vconsole.conf KEYMAP=uk For convenience, localectl may be used to set the console keymap. It will change the # localectl set-keymap --no-convert keymap The If required, the keymap from Tip
Using XKB keymapsXKB keymaps aren't directly usable in the console. They need to be converted to KBD keymaps. This can be done with ckbcompAUR. For instance, this is how you can use the EurKEY keymap in the console: # ckbcomp eu > /usr/share/kbd/keymaps/eurkey.map # loadkeys eurkey Not every feature can be converted, so you might see some warnings about things that will be missing. Usually they aren't dealbreakers though.
Creating a custom keymapWhen using the console, you can use hotkeys to print a specific character. Moreover we can also print a sequence of characters and some escape sequences. Thus, if we print the sequence of characters constituting a command and afterwards an escape character for a new line, that command will be executed. One method of doing this is editing the keymap file. However, since it will be rewritten anytime the package it belongs to is updated, editing this file is discouraged. It is better to integrate the existing keymap with a personal keymap. The First, create a keymap file. This keymap file can be anywhere, but one method is to mimic the directory hierarchy in As a side note, it is worth noting that such a personal keymap is useful also to redefine the behaviour of keys already treated by the default keymap: when loaded with Tip
Adding directivesTwo kinds of directives are required in this personal keymap. First of all, the keycode directives, which matches the format seen in the default keymaps. These directives associate a keycode with a keysym. Keysyms represent keyboard actions. The actions available include outputting character codes or character sequences, switching consoles or keymaps, booting the machine, and many other actions. The full currently active keymap can be obtained with # dumpkeys -l Most keysyms are intuitive. For example, to set key 112 to output an 'e', the directive will be: keycode 112 = e To set key 112 to output a euro symbol, the directive will be: keycode 112 = euro Some keysym are not immediately connected to a keyboard actions. In particular, the keysyms prefixed by a capital F and one to three digits (F1-F246) constituting a number greater than 30 are always free. This is useful directing a hotkey to output a sequence of characters and other actions: keycode 112 = F70 Then, F70 can be bound to output a specific string: string F70 = "Hello" When key 112 is pressed, it will output the contents of F70. In order to execute a printed command in a terminal, a newline escape character must be appended to the end of the command string. For example, to enter a system into hibernation, the following keymap is added: string F70 = "sudo systemctl hibernate\n" Other examples
include "linux-with-two-alt-keys"
keycode 1 = Caps_Lock keycode 58 = Escape
keycode 58 = Control
keycode 29 = Caps_Lock keycode 58 = Control Saving changesIn order to make use of the personal keymap, it must be loaded with loadkeys: # loadkeys /usr/local/share/kbd/keymaps/personal.map However this keymap is only active for the current session. In order to load the keymap at boot, specify the full path to the file in the Adjusting typematic delay and rateThe typematic delay indicates the amount of time (typically in milliseconds) a key needs to be pressed and held 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. Note that these settings are configured separately for the console and for Xorg. # 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 systemd serviceA systemd service can be used to set the keyboard rate. For example: /etc/systemd/system/kbdrate.service [Unit] Description=Keyboard repeat rate in tty. [Service] Type=oneshot RemainAfterExit=yes StandardInput=tty StandardOutput=tty ExecStart=/usr/bin/kbdrate --silent --delay 250 --rate 30 [Install] WantedBy=multi-user.target Then start/enable the Layout switchingNote General layout toggling like on X11 is not supported on the console. The following will not work with arbitrary layout combinations, especially some main layouts will not allow this at all.
Layout switching can only be simulated by establishing a different layout on one of the higher layers (typically the 3rd, For a list of layouts that likely support this, run $ find /usr/share/kbd/keymaps -exec zgrep -l 'AltGr_Lock' '{}' ';'
You can test this by passing main and augmenting layout to loadkeys, e.g. # loadkeys us mk If it worked, the 3rd level shift ( Note If the second layout only prints squares, this is probably a font configuration issue.
For a permanent configuration, set the |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |