Getting a Keyboard to Work in X

X's keyboard mapping is set up in the main X configuration file, which is called XF86Config or XF86Config-4 and is stored in /etc or/etc/X11. This file contains a section that includes various keyboard parameters:

Section "InputDevice" Identifier "Keyboardl" Driver "Keyboard" Option "XkbModel" "pc105" Option "XkbLayout" "us"

Option "XkbOptions

Option "AutoRepeat" "250 12" EndSection

Tip You can type setxkbmap -v to view your current X keyboard settings, even if they've been changed since starting X.

You can ignore some of these entries. The most important are listed here:

Option "XkbModer "pc105" This line tells X what set of scan codes to expect from the keyboard. In the U.S., pel 01, pc104, and pc105 keyboards are common. The macintosh setting is appropriate for Linux running on Macintoshes, and you should use sun if you've got a Sun keyboard. You can use the setxkbmap -model name command to change the keyboard model name after X has started.

Option "XkbLayout" "us" This option tells the system how to map scan codes to X terminal codes. Most options are two-letter country codes, such as us for the U.S., de for Germany, and so on. You can find a list of codes and their meanings in the

/usr/X11 R6/lib/X11/xkb/symbols.dirfile. You can load a new keyboard layout with the setxkbmap -symbols layout-name command, where layout-name is the name of an appropriate layout.

Option "AutoRepeat" "250 12" This line isn't present in most configurations, but you can add it to adjust the keyboard repeat rate. The 250 in this example is the delay before the keys begin repeating, in milliseconds; and 12 is the repeat rate in characters per second. You can also change the repeat rate after logging in or launching X by using the xset r rate delay repeat-rate command, where delay is the delay period and repeat-rate is the repeat rate. The GNOME desktop environment includes a GUI control to adjust the keyboard repeat rate as part of its Control Center, but KDE lacks an equivalent.

If you want to modify just a few keys, you can use the -e option to xmodmap to modify a single key in the keyboard map. For instance, if your Tab key is mapped incorrectly, you could use the following command to fix it:

If you collect several such corrections, you can put them in a file and load them all by typing xmodmap filename, where filename is the name of the file holding the modification. Many X configurations automatically load the .Xmodmap file from the user's home directory in this way whenever a user logs in or starts X.

If you need to modify your keyboard configuration because you're using a keyboard for a non-English language, one additional step may be helpful, although it's not technically a keyboard issue: Set the LANG environment variable in the ,bash_profile file in your home directory. This variable tells many programs what language to use for menus and on-screen displays. (Some programs, such as Mozilla, rely upon their own unique language settings, though.) You can find a set of language codes in the /usr/X11 R6/lib/X11/locale directory.

Using a Dvorak Keyboard Layout

If you're willing to invest some time in learning a new keyboard layout, the Dvorak layout may be worth investigating. Experienced typists who learn Dvorak often report being able to type faster with Dvorak than with the traditional QWERTY layout. You can load a Dvorak layout in Linux's text mode by typing loadkeys dvorak, or by

This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to regist* modifying your startup scripts to run this command.

In theory, you should be able to specify dvorak as the XkbLayout option to use a Dvorak layout in X. In practice, though, this may not work correctly. The http://home.xyzz.org/dvorak/ site includes a file that can be used as a .Xmodmap file to create a Dvorak layout.

0 0

Post a comment