Difference between revisions of "KEYMAP"

From ArchWiki
Jump to: navigation, search
(forgot to actually add "Colemak" to the table...; adding Dvorak too; added Note box for basic troubleshooting)
(add into related category)
(42 intermediate revisions by 29 users not shown)
Line 1: Line 1:
[[Category:Internationalization (English)]]
+
[[Category:Internationalization]]
{{i18n|KEYMAP}}
+
[[Category:Keyboards]]
The '''KEYMAP''' variable is specified in the {{Filename|/etc/rc.conf}} file. It defines what keymap the keyboard is in the virtual consoles. Keytable files are provided by the {{Package Official|kbd}} package.
+
[[de:KEYMAP]]
 +
[[es:KEYMAP]]
 +
[[fr:KEYMAP]]
 +
[[ja:KEYMAP]]
 +
[[pt:KEYMAP]]
 +
[[tr:Klavye_düzeni]]
 +
[[zh-CN:KEYMAP]]
 +
==Introduction and basic configuration==
  
==Keyboard layouts==
+
The virtual console (keyboard mapping, console font, and console map) is configured in {{ic|/etc/vconsole.conf}}. It defines what keymap the keyboard is in the virtual consoles. Keytable files are provided by the {{Pkg|kbd}} package. An example {{ic|/etc/vconsole.conf}} is shown below:
This is the list of known keymap settings to work for the corresponding keyboard layouts. Usually the "map.gz" extension can be ignored.
+
Most keymaps can be found in the {{Filename|/usr/share/kbd/keymaps/i386/''layout''}} (''layout''=qwerty, azerty, dvorak, etc.) directory.
+
  
Less common but nonetheless useful keymaps for Arch Linux are found in the {{Filename|/usr/share/kbd/keymaps/''architecture''}} (''architecture''=mac, sun, etc.) directory.
+
{{hc|/etc/vconsole.conf|2=
 +
KEYMAP=us
 +
FONT=lat9w-16
 +
FONT_MAP=8859-1_to_uni}}
  
{{Note|In an X session, you can use setxkbmap to instantly apply keyboard layout: {{Codeline|setxkbmap -layout dvorak}}}}
+
{{Note|As of {{pkg|systemd}}-194, the built-in ''kernel'' font and the ''us'' keymap are used if {{ic|1=KEYMAP=}} and {{ic|1=FONT=}} are empty or not set.}}
  
{{Note|If these keymaps do not work for you, try removing the {{Codeline|.map.gz}} from the keymap name. If that does not work, make sure the keymap file exists in {{Filename|/usr/share/kbd/keymaps/}} using {{Codeline|find}}: {{Codeline|find /usr/share/kbd/keymaps/ -name "*[your desired keymap]*"}}}}
+
Another way to set the keyboard mapping (keymap) is using {{ic|localectl}}:
  
<table border="1" cellpadding="2" cellspacing="0">
+
# localectl set-keymap de
<tr>
+
 
<th>Keymap setting</th>
+
{{ic|localectl}} can also be used to set the X11 keymap:
<th>Keyboard</th>
+
 
</tr>
+
# localectl set-x11-keymap de
<tr>
+
 
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"be-latin1.map.gz"}}</td>
+
See {{ic|man 1 localectl}} and {{ic|man 5 vconsole.conf}} for details.
<td>Belgian</td>
+
 
</tr>
+
== Keyboard layouts ==
<tr>
+
 
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"br-abnt2.map.gz"}}</td>
+
This is the list of known keymap settings to work for the corresponding keyboard layouts. Most keymaps can be found in the {{ic|/usr/share/kbd/keymaps/i386/''layout''}} (''layout''=qwerty, azerty, dvorak, etc.) directory.
<td>Brazilian Portuguese</td>
+
 
</tr>
+
Less common but nonetheless useful keymaps for Arch Linux are found in the {{ic|/usr/share/kbd/keymaps/''architecture''}} (''architecture''=mac, sun, etc.) directory.
<tr>
+
 
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"cf.map.gz"}}</td>
+
You can find more info about your keyboard layout with:
<td>Canadian-French</td>
+
{{ic|less /usr/share/X11/xkb/rules/base.lst}}
</tr>
+
 
<tr>
+
{{Note|
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"ca_multi.map.gz"}}</td>
+
* In an X session, you can use setxkbmap to instantly apply keyboard layout: {{ic|setxkbmap -layout dvorak}}
<td>Canadian Multilingual (''currently only available in the [[Arch User Repository|AUR]]'')</td>
+
* You can also use this method to modify single keys. This command would assign the compose functionality to the caps lock key: {{ic|setxkbmap -option 'compose:caps'}}. This allows for example to write umlauts easily. Example for Umlaut A: {{ic| CAPSLOCK, ", A}}  ->  Ä. You can also configure the right Windows key as a Compose key with {{ic|setxkbmap -option 'compose:rwin'}}
</tr>
+
* If these keymaps do not work for you, make sure the keymap file exists in {{ic|/usr/share/kbd/keymaps/}} using {{ic|find}}: {{ic|find /usr/share/kbd/keymaps/ -name "*[your desired keymap]*"}}
<tr>
+
* You can see some instructions on how to use some keymaps in their respective files with: {{ic|zless /usr/share/kbd/keymaps/.../.../xx.map.gz}}}}
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"colemak"}}</td>
+
 
<td>Colemak (US)</td>
+
{| class="wikitable" border="1"
</tr>
+
|-
<tr>
+
!  Keyboard
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"croat.map.gz"}}</td>
+
Keymap setting
<td>Croatian</td>
+
|-
</tr>
+
|-
<tr>
+
|Armenian
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"cz-lat2.map.gz"}}</td>
+
|{{ic|KEYMAP<nowiki>=</nowiki>am}}
<td>Czech</td>
+
|-
</tr>
+
|Armenian (Eastern)
<tr>
+
|{{ic|KEYMAP<nowiki>=</nowiki>am -variant eastern}}
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"dvorak"}}</td>
+
|-
<td>Dvorak</td>
+
|Belgian
</tr>
+
|{{ic|KEYMAP<nowiki>=</nowiki>be-latin1}}
<tr>
+
|-
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"fr-latin9.map.gz"}}</td>
+
|Brazilian Portuguese
<td>French</td>
+
|{{ic|KEYMAP<nowiki>=</nowiki>br-abnt2}}
</tr>
+
|-
<tr>
+
|Canadian-French
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"de-latin1.map.gz"}}</td>
+
|{{ic|KEYMAP<nowiki>=</nowiki>cf}}
<td>German</td>
+
|-
</tr>
+
|Canadian Multilingual (''in [[AUR]]'')  
<tr>
+
|{{ic|KEYMAP<nowiki>=</nowiki>ca_multi}}
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"de-latin1-nodeadkeys.map.gz"}}</td>
+
|-
<td>German (no dead keys)</td>
+
|Colemak ''(US)''
</tr>
+
|{{ic|KEYMAP<nowiki>=</nowiki>colemak}}
<tr>
+
|-
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"lt.baltic.map.gz"}}</td>
+
|Croatian
<td>Lithuanian (qwerty)</td>
+
|{{ic|KEYMAP<nowiki>=</nowiki>croat}}
</tr>
+
|-
<tr>
+
|Czech
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"no-latin1.map.gz"}}</td>
+
|{{ic|KEYMAP<nowiki>=</nowiki>cz-lat2}}
<td>Norwegian</td>
+
|-
</tr>
+
|Danish
<tr>
+
|{{ic|KEYMAP<nowiki>=</nowiki>dk}}
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"lat2-16.psfu.gz"}}</td>
+
|-
<td>Polish</td>
+
|Dvorak
</tr>
+
|{{ic|KEYMAP<nowiki>=</nowiki>dvorak}}
<tr>
+
|-
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"pt-latin9.map.gz"}}</td>
+
|Finnish
<td>Portuguese</td>
+
|{{ic|KEYMAP<nowiki>=</nowiki>fi-latin1}}
</tr>
+
|-
<tr>
+
|French
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"ro_win.map.gz"}}</td>
+
|{{ic|KEYMAP<nowiki>=</nowiki>fr-latin1}}
<td>Romanian</td>
+
|-
</tr>
+
|Georgian
<tr>
+
|{{ic|KEYMAP<nowiki>=</nowiki>ge}}
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"ru4.map.gz"}}</td>
+
|-
<td>Russian</td>
+
|German
</tr>
+
|{{ic|KEYMAP<nowiki>=</nowiki>de-latin1}}
<tr>
+
|-
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"slovene"}}</td>
+
|German ''(no dead keys)''
<td>Slovene</td>
+
|{{ic|KEYMAP<nowiki>=</nowiki>de-latin1-nodeadkeys}}
</tr>
+
|-
<tr>
+
|Greek
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"sv-latin1.map.gz"}}</td>
+
|{{ic|KEYMAP<nowiki>=</nowiki>gr}}
<td>Swedish</td>
+
|-
</tr>
+
|Italian
<tr>
+
|{{ic|KEYMAP<nowiki>=</nowiki>it}}
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"fr_CH-latin1.map.gz"}}</td>
+
|-
<td>Swiss-French</td>
+
|Japanese
</tr>
+
|{{ic|KEYMAP<nowiki>=</nowiki>jp106}}
<tr>
+
|-
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"sg-latin1.map.gz"}}</td>
+
|Lithuanian ''(qwerty)''
<td>Swiss-German</td>
+
|{{ic|KEYMAP<nowiki>=</nowiki>lt.baltic}}
</tr>
+
|-
<tr>
+
|Norwegian
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"de_CH-latin1.map.gz"}}</td>
+
|{{ic|KEYMAP<nowiki>=</nowiki>no-latin1}}
<td>Swiss-German</td>
+
|-
</tr>
+
|Polish
<tr>
+
|{{ic|KEYMAP<nowiki>=</nowiki>pl}}
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"es.map.gz"}}</td>
+
|-
<td>Spanish</td>
+
|Portuguese
</tr>
+
|{{ic|KEYMAP<nowiki>=</nowiki>pt-latin9}}
<tr>
+
|-
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"la-latin1.map.gz"}}</td>
+
|Romanian
<td>Spanish Latinoamerican</td>
+
|{{ic|KEYMAP<nowiki>=</nowiki>ro_win}}
</tr>
+
|-
<tr>
+
|Russian
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"tr_q-latin5.map.gz"}}</td>
+
|{{ic|KEYMAP<nowiki>=</nowiki>ru4}}
<td>Turkish</td>
+
|-
</tr>
+
|Singapore
<tr>
+
|{{ic|KEYMAP<nowiki>=</nowiki>sg-latin1}}
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"ua.map.gz"}}</td>
+
|-
<td>Ukrainian</td>
+
|Slovene
</tr>
+
|{{ic|KEYMAP<nowiki>=</nowiki>slovene}}
<tr>
+
|-
<td>{{Codeline|KEYMAP<nowiki>=</nowiki>"uk"}}</td>
+
|Swedish
<td>United Kingdom</td>
+
|{{ic|KEYMAP<nowiki>=</nowiki>sv-latin1}}
</tr>
+
|-
</table>
+
|Swiss-French
 +
|{{ic|KEYMAP<nowiki>=</nowiki>fr_CH-latin1}}
 +
|-
 +
|Swiss-German
 +
|{{ic|KEYMAP<nowiki>=</nowiki>de_CH-latin1}}
 +
|-
 +
|Spanish Spaniard
 +
|{{ic|KEYMAP<nowiki>=</nowiki>es}}
 +
|-
 +
|Spanish Latin American
 +
|{{ic|KEYMAP<nowiki>=</nowiki>la-latin1}}
 +
|-
 +
|Spanish Dvorak
 +
|{{ic|KEYMAP<nowiki>=</nowiki>dvorak-es}}
 +
|-
 +
|Turkish
 +
|{{ic|KEYMAP<nowiki>=</nowiki>tr_q-latin5}}
 +
|-
 +
|Ukrainian
 +
|{{ic|KEYMAP<nowiki>=</nowiki>ua}}
 +
|-
 +
|United Kingdom
 +
|{{ic|KEYMAP<nowiki>=</nowiki>uk}}
 +
|}
 +
 
 +
== Configuring the console keymap ==
 +
 
 +
# {{ic|cd /usr/share/kbd/keymaps/i386/qwerty}}.
 +
# Copy your default keymap ({{ic|us.map.gz}}) to a new file {{ic|personal.map.gz}}.
 +
# {{ic|gunzip}} the new map file.
 +
# Edit {{ic|personal.map}} using your favorite editor. Examples:
 +
#* '''Make the Right Alt key same as Left Alt key (Emacs)'''<br>change the line {{ic|include "linux-with-alt-and-altgr"}} to {{ic|include "linux-with-two-alt-keys"}}.
 +
#* '''Swap CapsLock with Escape (Vim)'''<br>make {{ic|keycode 1 <nowiki>=</nowiki> Caps_Lock}} and {{ic|keycode 58 <nowiki>=</nowiki> Escape}}.
 +
#* '''Make CapsLock another Control key'''<br>change the line {{ic|keycode 58 <nowiki>=</nowiki> Caps_Lock}} to {{ic|keycode 58 <nowiki>=</nowiki> Control}}.
 +
#* '''Swap CapsLock with Left Control key'''<br>make {{ic|keycode 29 <nowiki>=</nowiki> Caps_Lock}} and {{ic|keycode 58 <nowiki>=</nowiki> Control}}.
 +
# {{ic|gzip}} the map file.
 +
# Change the default keyboard layout file that will be used by editing {{ic|/etc/vconsole.conf}} (you might have to create this file) and changing the line that says {{ic|KEYMAP<nowiki>=</nowiki>us}} to {{ic|KEYMAP<nowiki>=</nowiki>personal}}.
 +
# Reboot to use your keymap the way nature intended (or run "loadkeys personal").

Revision as of 03:33, 14 September 2013

Introduction and basic configuration

The virtual console (keyboard mapping, console font, and console map) is configured in /etc/vconsole.conf. It defines what keymap the keyboard is in the virtual consoles. Keytable files are provided by the kbd package. An example /etc/vconsole.conf is shown below:

/etc/vconsole.conf
KEYMAP=us
FONT=lat9w-16
FONT_MAP=8859-1_to_uni
Note: As of systemd-194, the built-in kernel font and the us keymap are used if KEYMAP= and FONT= are empty or not set.

Another way to set the keyboard mapping (keymap) is using localectl:

# localectl set-keymap de

localectl can also be used to set the X11 keymap:

# localectl set-x11-keymap de

See man 1 localectl and man 5 vconsole.conf for details.

Keyboard layouts

This is the list of known keymap settings to work for the corresponding keyboard layouts. Most keymaps can be found in the /usr/share/kbd/keymaps/i386/layout (layout=qwerty, azerty, dvorak, etc.) directory.

Less common but nonetheless useful keymaps for Arch Linux are found in the /usr/share/kbd/keymaps/architecture (architecture=mac, sun, etc.) directory.

You can find more info about your keyboard layout with: less /usr/share/X11/xkb/rules/base.lst

Note:
  • In an X session, you can use setxkbmap to instantly apply keyboard layout: setxkbmap -layout dvorak
  • You can also use this method to modify single keys. This command would assign the compose functionality to the caps lock key: setxkbmap -option 'compose:caps'. This allows for example to write umlauts easily. Example for Umlaut A: CAPSLOCK, ", A -> Ä. You can also configure the right Windows key as a Compose key with setxkbmap -option 'compose:rwin'
  • If these keymaps do not work for you, make sure the keymap file exists in /usr/share/kbd/keymaps/ using find: find /usr/share/kbd/keymaps/ -name "*[your desired keymap]*"
  • You can see some instructions on how to use some keymaps in their respective files with: zless /usr/share/kbd/keymaps/.../.../xx.map.gz
Keyboard Keymap setting
Armenian KEYMAP=am
Armenian (Eastern) KEYMAP=am -variant eastern
Belgian KEYMAP=be-latin1
Brazilian Portuguese KEYMAP=br-abnt2
Canadian-French KEYMAP=cf
Canadian Multilingual (in AUR) KEYMAP=ca_multi
Colemak (US) KEYMAP=colemak
Croatian KEYMAP=croat
Czech KEYMAP=cz-lat2
Danish KEYMAP=dk
Dvorak KEYMAP=dvorak
Finnish KEYMAP=fi-latin1
French KEYMAP=fr-latin1
Georgian KEYMAP=ge
German KEYMAP=de-latin1
German (no dead keys) KEYMAP=de-latin1-nodeadkeys
Greek KEYMAP=gr
Italian KEYMAP=it
Japanese KEYMAP=jp106
Lithuanian (qwerty) KEYMAP=lt.baltic
Norwegian KEYMAP=no-latin1
Polish KEYMAP=pl
Portuguese KEYMAP=pt-latin9
Romanian KEYMAP=ro_win
Russian KEYMAP=ru4
Singapore KEYMAP=sg-latin1
Slovene KEYMAP=slovene
Swedish KEYMAP=sv-latin1
Swiss-French KEYMAP=fr_CH-latin1
Swiss-German KEYMAP=de_CH-latin1
Spanish Spaniard KEYMAP=es
Spanish Latin American KEYMAP=la-latin1
Spanish Dvorak KEYMAP=dvorak-es
Turkish KEYMAP=tr_q-latin5
Ukrainian KEYMAP=ua
United Kingdom KEYMAP=uk

Configuring the console keymap

  1. cd /usr/share/kbd/keymaps/i386/qwerty.
  2. Copy your default keymap (us.map.gz) to a new file personal.map.gz.
  3. gunzip the new map file.
  4. Edit personal.map using your favorite editor. Examples:
    • Make the Right Alt key same as Left Alt key (Emacs)
      change the line include "linux-with-alt-and-altgr" to include "linux-with-two-alt-keys".
    • Swap CapsLock with Escape (Vim)
      make keycode 1 = Caps_Lock and keycode 58 = Escape.
    • Make CapsLock another Control key
      change the line keycode 58 = Caps_Lock to keycode 58 = Control.
    • Swap CapsLock with Left Control key
      make keycode 29 = Caps_Lock and keycode 58 = Control.
  5. gzip the map file.
  6. Change the default keyboard layout file that will be used by editing /etc/vconsole.conf (you might have to create this file) and changing the line that says KEYMAP=us to KEYMAP=personal.
  7. Reboot to use your keymap the way nature intended (or run "loadkeys personal").