====== 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 ''/etc/rc.d/rc.keymap'': #!/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. Please note that if you decide not to change the default layout (US) during the installation process, the file ''/etc/rc.d/rc.keymap'' will 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 ''/usr/share/kdb/keymaps/'' directory. =====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 ''/etc/hal/fdi/policy/'': cp /usr/share/hal/fdi/policy/10osvendor/10-keymap.fdi /etc/hal/fdi/policy/ Edit the file: vim /etc/hal/fdi/policy/10.keymap.fdi Replacing ''us'' with a keymap of your choice (in my case it is ''gb''): us gb ===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/ Edit the ''90-keyboard-layout.conf'' file specifying the layout (eg. ''gb''): vim /etc/X11/xorg.conf.d/90-keyboard-layout.conf 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. ===Slackware 15.0=== From Slackware 15.0 on, since ''libinput'' can be used as well, there's two files you can edit: cp /etc/X11/xorg.conf.d/90-keyboard-layout-evdev.conf /etc/X11/xorg.conf.d/ and cp /etc/X11/xorg.conf.d/91-keyboard-layout-libinput.conf /etc/X11/xorg.conf.d/ Edit these files specifying the layout (eg. ''gb''): nano /etc/X11/xorg.conf.d/90-keyboard-layout-evdev.conf 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 And same with: nano /etc/X11/xorg.conf.d/91-keyboard-layout-libinput.conf 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: setxkbmap pl Below are some ways of changing keyboard layouts within particular desktop environments or window managers. ===KDE=== [[.keyboard_layout_in_kde|Keyboard Layout in KDE]] ===Xfce=== [[.keyboard_layout_in_xfce|Keyboard Layout in Xfce]] ===Fluxbox=== [[.keyboard_layout_in_fluxbox|Keyboard Layout in Fluxbox]] ===i3=== [[.keyboard_layout_in_i3|Keyboard Layout in i3]] ====== Sources ====== * Originally written by [[wiki:user:sycamorex]] {{tag>howtos keyboard settings hardware author_sycamorex}}