[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
XKB and Keyboard Layouts
XKB is a very powerful system for controlling keyboard layouts on your Linux
machine. I do not know how old it is, Jon says it works in Xfree 4.3 as well,
but I have only tried it in xorg. It will allow you to set up something like
what I have on my computer: my standard qwerty keyboard can switch to Dvorak
layout by pressing both shift keys at the same time, and switch back the same
way. My scroll lock LED comes on when I am in Dvorak mode, and my caps lock key
is now a third control key.
Unlike user xmodmap files, this will affect all users on the system, so avoid
doing anything too weird if others use your computer. Also, you need root access
to do this, as you will obviously be editing your X configuration scripts.
This is the relavent section of my /etc/X11/xorg.conf with the parts I was
talking about in the meeting today. The comments I have added should help
anybody that wants to try this out. The complete listing and description of
various keyboard models, keyboard layouts, and XKB options can be found in
/etc/X11/xkb/rules/xorg.lst
This should work in newer versions of xfree as well, if you are using that,
replace xorg with xfree86 where nessicary and it should work.
If you look around in /etc/X11/xkb you should be able to figure out how to
create your own rules, and modify existing options and such. For example,
/etc/X11/xkb/rules/xorg specifies what each group switching option does in terms
of scripts in /etc/X11/xkb/symbols/group. You can edit this to make your own
group switching rules, such as to hit the right windows key, left alt, and right
shift to toggle keyboard layouts.
# **********************************************************************
# Core keyboard's InputDevice section
# **********************************************************************
Section "InputDevice"
Identifier "Keyboard1"
Driver "kbd"
# For most OSs the protocol can be omitted (it defaults to "Standard").
# When using XQUEUE (only for SVR3 and SVR4, but not Solaris),
# uncomment the following line.
# Option "Protocol" "Xqueue"
Option "AutoRepeat" "500 30"
# Specify which keyboard LEDs can be user-controlled (eg, with xset(1))
# Option "Xleds" "1 2 3"
# Option "LeftAlt" "Meta"
# Option "RightAlt" "ModeShift"
# These are the XKB settings I have customized to get my keyboard
# working the way I want.
# XkbRuleset to use. xfree86 and xorg are probably the same,
# by default one is a symlink to the other.
Option "XkbRules" "xorg"
# Option "XkbRules" "xfree86"
# Physical keyboard model to use. There are a ton of these,
# including IBM Thinkpad keyboards, Microsoft Natural Pro,
# Yahoo! Internet Keyboard, etc. My IBM Model M uses pc101.
Option "XkbModel" "pc101"
# Option "XkbModel" "pc104"
# Option "XkbModel" "microsoftpro"
# Option "XkbModel" "thinkpad"
# Keymapping(s) to use. There are a ton of these as well,
# including US (standard English QWERTY), Dvorak, Armenian,
# US International, Finnish, etc. You can specify multiple
# layouts and switch between them, as seen below.
Option "XkbLayout" "us,dvorak"
# Option "XkbLayout" "us_intl,am,fi"
# These options do various things as described below:
# ctrl:nocaps removes the caps lock key, and replaces it with
# a control key. You can use ctrl:swapcaps instead to simply
# swap them. grp:shift_toggle uses both shift keys pressed
# simultaniously to swap layouts. grp_led:scroll lights up my
# scroll lock LED when in Dvorak layout. I do not know what it
# would do with more than two layouts in the list, however.
# perhaps light on anything other than the first layout?
Option "XkbOptions" "ctrl:nocaps,grp:shift_toggle,grp_led:scroll"
EndSection
--
"They that can give up essential liberty | Adam Jaskiewicz <ajjaskie@xxxxxxx>
to obtain a little temporary security | http://middlearth.homelinux.org
deserve neither liberty nor security." | School | Home (summer)
--Benjamin Franklin | (906) 483-6247 | (734) 668-6240