This is an old revision of the document!
Table of Contents
Layout-switching in the Console
The command 'loadkeys' can be used to set a new layout. The following outline explains how to implement such a mechanism in dCore. Due to the size of the needed packages, some optimisation is desirable (cf. note below).
Warning about log-in prompt
The man-page of 'loadkeys' explains a possible side-effect of changing the keyboard-layout in the console. “Note that because the changes affect all the virtual consoles, they also outlive your session. This means that even at the login prompt the key bindings may not be what the user expects.”
Installing
- Import and load the kbd package, providing 'loadkeys'. This extension is to be made persistent by adding it to 'sceboot.lst'.
- Import and load the console-date package. This extension is only used in an ephemeral way and can be removed afterwards.
Note
The package kbd has a almost one hundred dependencies going back to, e.g. passwd and mount. Thus it is desirable to include it into a base extension rather than used it as an isolated extension as here presented. That may be done at a later time without need for repeating the whole procedure.
Testing
- In a console (virtual TTY, accessed by Ctrl+Alt+F#), 'sudo loadkeys us' should output “/usr/share/keymaps/i386/qwerty/us.kmap.gz”.
- Determine your keyboard layout by 'sudo loadkeys <…>' by substituting some file name in '/usr/share/keymaps/', likely under 'i386/qwerty/'. The output must confirm the loading of the respective file.
Hint: if you should have loaded a non-functional keyboard layout, use the arrow-up key to get back to the line loading the US-layout.
Notes
- The naming scheme remains a bit hazy. The Swiss-German layout, for instance, may well be loaded by 'loadkeys ch' but the command does not produce any output. Indeed, there is no file 'ch*' at all. After some research, the correct code was found as 'sg_latin1'.
Persistence
- Copy the needed files aside and remove the console-date extension.
- After a re-boot, create the 'keymaps/'-directory by, e.g. 'sudo mkdir -p /usr/share/keymaps/i386/qwerty' and copy the files in there.
- Add the file names to '.filetool.lst'.
Personalisation
Standard layout
In order to specify a standard layout for the console, add the following to '~/.profile'.
~/.profile: sudo loadkeys <LAYOUT>
The US-keyboard layout, for example, is very well suited for working on the command line.
Aliases
In order to quickly switch between layout, add the following to '~/.ashrc'.
~/.ashrc: alias us='sudo loadkeys us' alias <CODE>='sudo loadkeys <LAYOUT>'