https://wiki.archlinux.org/api.php?action=feedcontributions&user=Jelliott&feedformat=atom
ArchWiki - User contributions [en]
2024-03-29T01:23:44Z
User contributions
MediaWiki 1.41.0
https://wiki.archlinux.org/index.php?title=Accents_on_US_keyboards&diff=235924
Accents on US keyboards
2012-11-18T18:37:05Z
<p>Jelliott: /* What to do with the xmodmap file */</p>
<hr />
<div>[[Category:Keyboards]]<br />
[[Category:Internationalization]]<br />
[[es:Accents on US keyboards]]<br />
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 {{Ic|xmodmap}} utility.<br />
<br />
== XCompose ==<br />
<br />
The compose key, when pressed in sequence with other keys, produces a Unicode character. E.g., in most configurations pressing <Compose> ' e produces é.<br />
<br />
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:<br />
<br />
setxkbmap -option compose:ralt<br />
<br />
If you want another key to be your Compose key, see {{Ic|/usr/share/X11/xkb/rules/base.lst}} at the {{Ic|compose:}} lines.<br />
<br />
You may also edit your {{Ic|/etc/X11/xorg.conf.d/20-evdev.conf}} and change InputClass / 'evdev keyboard catchall' to look like this.<br />
<br />
Section "InputClass"<br />
Identifier "evdev keyboard catchall"<br />
MatchIsKeyboard "on"<br />
MatchDevicePath "/dev/input/event*"<br />
Driver "evdev"<br />
Option "XkbOptions" "terminate:ctrl_alt_bksp,compose:ralt"<br />
EndSection<br />
<br />
<br />
=== Key combinations ===<br />
<br />
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}}.<br />
<br />
Some of the default combinations are listed below:<br />
<br />
Compose ` a : à<br />
Compose ' e : é<br />
Compose ^ i : î<br />
Compose ~ n : ñ<br />
Compose / o : ø<br />
Compose " u : ü<br />
Compose o c : ©<br />
Compose + - : ±<br />
Compose : - : ÷<br />
<br />
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.<br />
<br />
=== Environment variables ===<br />
<br />
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:<br />
<br />
export GTK_IM_MODULE=xim<br />
<br />
== xmodmap ==<br />
<br />
The {{Ic|xmodmap}} utility that is supplied with [[Xorg]] allows user to completely remap the keyboard. The following is an example configuration:<br />
<br />
Note: AltGr is the Alt key on the right-hand side of the space bar.<br />
<br />
AltGr + e -> é<br />
AltGr + r -> è<br />
AltGr + a -> à<br />
AltGr + u -> ù<br />
AltGr + i -> ì<br />
AltGr + o -> ò<br />
AltGr + c -> ç<br />
AltGr + [ -> «<br />
AltGr + ] -> »<br />
AltGr + ; -> dead diaresis (ï, ü, etc.)<br />
AltGr + 6 -> dead circumflex (î, ê, etc.) <br />
<br />
=== A useful utility to produce a xmodmap file ===<br />
<br />
On [http://www.jwz.org/xkeycaps 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'':<br />
# pacman -S xkeycaps<br />
<br />
=== Example xmodmap file ===<br />
<br />
This is an xmodmap file which remaps keys to match the above example.<br />
<br />
clear Mod1<br />
clear Mod2<br />
! us.map with a few redefinitions<br />
keycode 9 = Escape Escape<br />
keycode 10 = 1 exclam<br />
keycode 11 = 2 at at<br />
keycode 12 = 3 numbersign<br />
keycode 13 = 4 dollar dollar<br />
keycode 14 = 5 percent currency<br />
keycode 15 = 6 asciicircum dead_circumflex<br />
keycode 16 = 7 ampersand braceleft<br />
keycode 17 = 8 asterisk bracketleft<br />
keycode 18 = 9 parenleft bracketright<br />
keycode 19 = 0 parenright braceright<br />
keycode 20 = minus underscore backslash<br />
keycode 21 = equal plus<br />
keycode 22 = BackSpace Delete<br />
keycode 23 = Tab Tab<br />
keycode 24 = q<br />
keycode 25 = w<br />
keycode 26 = e E eacute<br />
keycode 27 = r R egrave<br />
keycode 28 = t<br />
keycode 29 = y<br />
keycode 30 = u U ugrave<br />
keycode 31 = i I igrave<br />
keycode 32 = o O ograve<br />
keycode 33 = p<br />
keycode 34 = bracketleft braceleft guillemotleft<br />
keycode 35 = bracketright braceright guillemotright<br />
keycode 36 = Return<br />
keycode 37 = Control_L<br />
keycode 38 = a A agrave<br />
keycode 39 = s<br />
keycode 40 = d<br />
keycode 41 = f<br />
keycode 42 = g<br />
keycode 43 = h<br />
keycode 44 = j<br />
keycode 45 = k<br />
keycode 46 = l<br />
keycode 47 = semicolon colon dead_diaeresis<br />
keycode 48 = apostrophe quotedbl<br />
keycode 49 = grave asciitilde dead_grave<br />
keycode 50 = Shift_L<br />
keycode 51 = backslash bar<br />
keycode 52 = z<br />
keycode 53 = x<br />
keycode 54 = c C ccedilla<br />
keycode 55 = v<br />
keycode 56 = b<br />
keycode 57 = n<br />
keycode 58 = m<br />
keycode 59 = comma less apostrophe<br />
keycode 60 = period greater quotedbl<br />
keycode 61 = slash question<br />
keycode 62 = Shift_R<br />
keycode 63 = KP_Multiply<br />
keycode 64 = Alt_L Meta_L<br />
keycode 65 = space space<br />
keycode 66 = Caps_Lock<br />
keycode 67 = F1 F11<br />
keycode 68 = F2 F12<br />
keycode 69 = F3 F13<br />
keycode 70 = F4 F14<br />
keycode 71 = F5 F15<br />
keycode 72 = F6 F16<br />
keycode 73 = F7 F17<br />
keycode 74 = F8 F18<br />
keycode 75 = F9 F19<br />
keycode 76 = F10 F20<br />
keycode 77 = Num_Lock<br />
keycode 78 = Scroll_Lock<br />
keycode 79 = KP_7<br />
keycode 80 = KP_8<br />
keycode 81 = KP_9<br />
keycode 82 = KP_Subtract<br />
keycode 83 = KP_4<br />
keycode 84 = KP_5<br />
keycode 85 = KP_6<br />
keycode 86 = KP_Add<br />
keycode 87 = KP_1<br />
keycode 88 = KP_2<br />
keycode 89 = KP_3<br />
keycode 90 = KP_0<br />
keycode 94 = less greater bar<br />
keycode 95 = F11 F11<br />
keycode 96 = F12 F12<br />
keycode 108 = KP_Enter<br />
keycode 109 = Control_R<br />
keycode 112 = KP_Divide<br />
keycode 113 = Mode_switch<br />
keycode 114 = Break<br />
keycode 110 = Find<br />
keycode 98 = Up<br />
keycode 99 = Prior<br />
keycode 100 = Left<br />
keycode 102 = Right<br />
keycode 115 = Select<br />
keycode 104 = Down<br />
keycode 105 = Next<br />
keycode 106 = Insert<br />
keycode 116 = Mode_switch<br />
! right windows-menu key, redefined as Compose key<br />
keycode 117 = Multi_key<br />
add Mod1 = Alt_L<br />
add Mod2 = Mode_switch<br />
<br />
=== What to do with the xmodmap file ===<br />
<br />
To use this configuration, put it in a hidden file called .xmodmap in your home directory:<br />
<br />
~/.xmodmap<br />
<br />
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. <br />
<br />
If you already have a .xinitrc file, type these commands in a terminal:<br />
<br />
cd<br />
echo "xmodmap ~/.xmodmap" >> .xinitrc<br />
<br />
If you do not have a .xinitrc file, do this:<br />
<br />
cd<br />
echo "xmodmap ~/.xmodmap" > .xinitrc<br />
chmod 755 .xinitrc</div>
Jelliott