Table of Contents
Setting a Keyboard Layout
Setting a keyboard layout is a necessary step if you do not want the default
us layout. Furthermore, some people quite often need to switch between layouts. Below you'll find ways of setting / changing the keyboard layout both in the console and in X.
Keyboard in the Console
Keyboard layout is first set during the installation process where you're asked to choose a relevant keyboard map. This setting only applies to the console before you start the X server (GUI).
It can be changed in
#!/bin/sh # Load the keyboard map. More maps are in /usr/share/kbd/keymaps. if [ -x /usr/bin/loadkeys ]; then /usr/bin/loadkeys uk.map fi
As you can see above, I use the UK layout. More keyboard layouts can be found in the directory mentioned above.
/etc/rc.d/rc.keymapwill not be created. If, at a later stage, you need to change it, you will need to create that file, copy the above code and choose one of the keymaps available in the
Keyboard Layout in X
Setting up a keyboard layout for X can be done in 2 ways: system-wide (regardless of your desktop environment or user) or on a desktop environment / window manager level.
Setting the Layout System-wide
Slackware 13.0 and 13.1
In Slackware 13.0 and 13.1
hal was responsible for keyboard mapping:
Copy the relevant
.fdi file to
cp /usr/share/hal/fdi/policy/10osvendor/10-keymap.fdi /etc/hal/fdi/policy/
Edit the file:
us with a keymap of your choice (in my case it is
<merge key=“input.xkb.layout” type=“string”>us</merge>
<merge key=“input.xkb.layout” type=“string”>gb</merge>
Slackware 13.37 and 14
From Slackware 13.37 on,
udev has taken over keyboard mapping functions and the procedure has changed as well:
cp /usr/share/X11/xorg.conf.d/90-keyboard-layout.conf /etc/X11/xorg.conf.d/
90-keyboard-layout.conf file specifying the layout (eg.
Section "InputClass" Identifier "keyboard-all" MatchIsKeyboard "on" MatchDevicePath "/dev/input/event*" Driver "evdev" Option "XkbLayout" "gb" #Option "XkbVariant" "" Option "XkbOptions" "terminate:ctrl_alt_bksp" EndSection
You also need to restart X for the change to take effect.
Setting the Layout in Particular Desktop Environments / Window Managers
Some environments by default include GUI tools to set the keyboard layout while others require tweaking the startup files and a manual use of the
setxkbmap command. You can use this command at any time if you want to change the keyboard layout in X. You might need to restart certain applications for the changes to take effect.
This, for example, would switch your keyboard layout to Polish:
Below are some ways of changing keyboard layouts within particular desktop environments or window managers.
- Originally written by sycamorex