Difference between revisions of "Accents on US keyboards"

From ArchWiki
Jump to: navigation, search
(Key combinations)
(fix double redirect)
(Tag: wiki-scripts)
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
#REDIRECT [[Xorg/Keyboard configuration#Configuring compose key]]
[[es: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 [[xmodmap]] utility.
== XCompose ==
The compose key, when pressed in sequence with other keys, produces a Unicode character. E.g., in most configurations pressing {{ic|<Compose> ' e}} produces {{ic|é}}.
Compose keys appeared on some computer keyboards decades ago, especially those produced by Sun Microsystems. However, it can be enabled on any keyboard with {{Ic|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 {{Ic|/usr/share/X11/xkb/rules/base.lst}} at the {{Ic|compose:}} lines.
You may also edit your {{Ic|/etc/X11/xorg.conf.d/10-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"
=== Key combinations ===
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 {{Ic|/usr/share/X11/locale/en_US.UTF-8/Compose}}.
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 {{Ic|~/.XCompose}} and editing it. The compose key works with any of the thousands of valid Unicode characters, including those outside the Basic Multilingual Plane. However, GTK does not use xim by default and therefore does not follow {{Ic|~/.XCompose}} keys. This can be fixed by forcing GTK to use xim by adding {{Ic|export GTK_IM_MODULE&#61;xim}} to {{Ic|~/.xprofile}}, or forcing individual apps to use xim by running them as {{Ic|GKT_IM_MODULE&#61;xim ''command''}}. However not all apps, such as Sublime-Text 2 know how to use xim, and so uim-scim can be used instead of xim once the scim-uim package is installed. Note that this was tested on KDE.
=== Environment variables ===
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:
export GTK_IM_MODULE=xim
== xmodmap ==
The {{Ic|xmodmap}} utility that is supplied with [[Xorg]] allows user to completely remap the keyboard. See [[xmodmap#Accents on US keyboards]] for more information.

Latest revision as of 06:52, 23 September 2018