Accents on US keyboards
Typing in foreign languages such as French, Italian and German can be difficult on an American keyboard. To remedy this, Xorg provides options such as the compose key and the
The compose key, when pressed in sequence with other keys, produces a Unicode character. E.g., in most configurations pressing <Compose> ' e produces é.
Compose keys appeared on some computer keyboards decades ago, especially those produced by Sun Microsystems. However, it can be enabled on any keyboard with
setxkbmap. For example, compose can be set to right alt by running:
setxkbmap -option compose:ralt
If you want another key to be your Compose key, see
/usr/share/X11/xkb/rules/base.lst at the
You may also edit your
/etc/X11/xorg.conf.d/20-evdev.conf and change InputClass / 'evdev keyboard catchall' to look like this.
Section "InputClass" Identifier "evdev keyboard catchall" MatchIsKeyboard "on" MatchDevicePath "/dev/input/event*" Driver "evdev" Option "XkbOptions" "terminate:ctrl_alt_bksp,compose:ralt" EndSection
By default, the compose key uses combinations defined in a file. The file used depends on the user's locale: an American using LC_CTYPE=en_US.UTF-8, for instance, would find the defaults in
Some of the default combinations are listed below:
Compose ` a : à Compose ' e : é Compose ^ i : î Compose ~ n : ñ Compose / o : ø Compose " u : ü Compose o c : © Compose + - : ± Compose : - : ÷
However, you can define your own compose key combinations by copying the default file to
~/.XCompose and editing it. The compose key works with any of the thousands of valid Unicode characters, including those outside the Basic Multilingual Plane.
Some unfriendly applications (including many GTK apps) will override the compose key and default to their own built-in combinations. You can typically fix this by setting environment variables; for instance, you can fix the behavior for GTK with:
xmodmap utility that is supplied with Xorg allows user to completely remap the keyboard. The following is an example configuration:
Note: AltGr is the Alt key on the right-hand side of the space bar. AltGr + e -> é AltGr + r -> è AltGr + a -> à AltGr + u -> ù AltGr + i -> ì AltGr + o -> ò AltGr + c -> ç AltGr + [ -> « AltGr + ] -> » AltGr + ; -> dead diaresis (ï, ü, etc.) AltGr + 6 -> dead circumflex (î, ê, etc.)
A useful utility to produce a xmodmap file
On this page you'll find XKeyCaps, a graphical front-end to xmodmap which makes it easier to produce an ideal xmodmap file. XKeyCaps is available from the community repository and can be installed with pacman:
# pacman -S xkeycaps
Example xmodmap file
This is an xmodmap file which remaps keys to match the above example.
clear Mod1 clear Mod2 ! us.map with a few redefinitions keycode 9 = Escape Escape keycode 10 = 1 exclam keycode 11 = 2 at at keycode 12 = 3 numbersign keycode 13 = 4 dollar dollar keycode 14 = 5 percent currency keycode 15 = 6 asciicircum dead_circumflex keycode 16 = 7 ampersand braceleft keycode 17 = 8 asterisk bracketleft keycode 18 = 9 parenleft bracketright keycode 19 = 0 parenright braceright keycode 20 = minus underscore backslash keycode 21 = equal plus keycode 22 = BackSpace Delete keycode 23 = Tab Tab keycode 24 = q keycode 25 = w keycode 26 = e E eacute keycode 27 = r R egrave keycode 28 = t keycode 29 = y keycode 30 = u U ugrave keycode 31 = i I igrave keycode 32 = o O ograve keycode 33 = p keycode 34 = bracketleft braceleft guillemotleft keycode 35 = bracketright braceright guillemotright keycode 36 = Return keycode 37 = Control_L keycode 38 = a A agrave keycode 39 = s keycode 40 = d keycode 41 = f keycode 42 = g keycode 43 = h keycode 44 = j keycode 45 = k keycode 46 = l keycode 47 = semicolon colon dead_diaeresis keycode 48 = apostrophe quotedbl keycode 49 = grave asciitilde dead_grave keycode 50 = Shift_L keycode 51 = backslash bar keycode 52 = z keycode 53 = x keycode 54 = c C ccedilla keycode 55 = v keycode 56 = b keycode 57 = n keycode 58 = m keycode 59 = comma less apostrophe keycode 60 = period greater quotedbl keycode 61 = slash question keycode 62 = Shift_R keycode 63 = KP_Multiply keycode 64 = Alt_L Meta_L keycode 65 = space space keycode 66 = Caps_Lock keycode 67 = F1 F11 keycode 68 = F2 F12 keycode 69 = F3 F13 keycode 70 = F4 F14 keycode 71 = F5 F15 keycode 72 = F6 F16 keycode 73 = F7 F17 keycode 74 = F8 F18 keycode 75 = F9 F19 keycode 76 = F10 F20 keycode 77 = Num_Lock keycode 78 = Scroll_Lock keycode 79 = KP_7 keycode 80 = KP_8 keycode 81 = KP_9 keycode 82 = KP_Subtract keycode 83 = KP_4 keycode 84 = KP_5 keycode 85 = KP_6 keycode 86 = KP_Add keycode 87 = KP_1 keycode 88 = KP_2 keycode 89 = KP_3 keycode 90 = KP_0 keycode 94 = less greater bar keycode 95 = F11 F11 keycode 96 = F12 F12 keycode 108 = KP_Enter keycode 109 = Control_R keycode 112 = KP_Divide keycode 113 = Mode_switch keycode 114 = Break keycode 110 = Find keycode 98 = Up keycode 99 = Prior keycode 100 = Left keycode 102 = Right keycode 115 = Select keycode 104 = Down keycode 105 = Next keycode 106 = Insert keycode 116 = Mode_switch ! right windows-menu key, redefined as Compose key keycode 117 = Multi_key add Mod1 = Alt_L add Mod2 = Mode_switch
What to do with the xmodmap file
To use this configuration, put it in a hidden file called .xmodmap in your home directory:
Some desktop environments such as GNOME will automatically detect the file and ask you if you want to use it. If you are using a desktop environment or a window manager which does not do this, you will have to add a line to an executable file called .xinitrc, located in your home directory. This file contains a list of commands that are executed after you log in.
If you already have a .xinitrc file, type these commands in a terminal:
cd echo "xmodmap ~/.xmodmap" >> .xinitrc
If you do not have a .xinitrc file, do this:
cd echo "xmodmap ~/.xmodmap" > .xinitrc chmod 755 .xinitrc