Editor's Note: Tip Top Tips is a semi-monthly column in The PCLinuxOS Magazine. Periodically, we will feature -- and possibly even expand upon -- one tip from the PCLinuxOS forum. The magazine will not accept independent tip submissions specifically intended for inclusion in the Tip Top Tips column. Rather, if you have a tip, share it in the PCLinuxOS forum's "Tips & Tricks" section. Your tip just may be selected for publication in The PCLinuxOS Magazine.
This month's tip comes from davecs.
I keep reading "reviews" on Ebay and Amazon UK that British people are buying keyboards online, only to find that they are American. The main problem they have is that the keyboard does not have a Sterling sign (£) on it, the quotedbl (") and at sign (@) are swapped over. The key that produces hash and tilde has backslash and pipe on it, backslash and pipe are no longer available, as there is one key less on the US keyboard! Everything will appear in the same place on the keyboard as they did before, but the legends on the keys are wrong.
If you switch to the US keyboard layout, everything will match up to what is on the keyboard, but you won't have access to a £-sign. So what to do?
There is a directory, /usr/share/X11/xkb/symbols/, that holds many keyboard maps, and the British one is "gb". If you look at it, you will see a number of sections. The first one is "default", and looks like this:
// based on a keyboard map from an 'xkb/symbols/gb' file
default partial alphanumeric_keys
xkb_symbols "basic" {
// Describes the differences between a very simple en_US
// keyboard and a very simple U.K. keyboard layout defined by
// the SVR4 European Language Supplement and sometimes also
// known as the IBM 166 layout.
include "latin"
name[Group1]="English (UK)";
key { [ 2, quotedbl, twosuperior, oneeighth ] };
key { [ 3, sterling, threesuperior, sterling ] };
key { [ 4, dollar, EuroSign, onequarter ] };
key { [apostrophe, at, dead_circumflex, dead_caron] };
key { [ grave, notsign, bar, bar ] };
key { [numbersign, asciitilde, dead_grave, dead_breve ] };
key { [ backslash, bar, bar, brokenbar ] };
include "level3(ralt_switch_multikey)"
};
Let me explain a few lines. The one that says include "latin", means that stuff is read in from another file, called "latin", in the same folder. That's a generic European key layout, which is basically the same as the American layout, but with four symbols shown on many keys instead of two. You might want to look at that file too.
Another very important line is include "level3(ralt_switch_multikey)". This enables the Right-Alt (Alt-Gr) key to act as a shift to the third entry for each key, and together with Shift, to access the fourth entry. So, we can fix the key moves by deleting some of them. If we delete the entry for the "2" key, it will restore the "latin" definition and put back the "@" sign. Deleting the keys , and will also put those keys back to the symbols on the keys. The key isn't present on a US keyboard so we can delete that too. The "4" key is left alone, so it will produce both "$" and "€". That leaves the "3" key. We need the "£" on that which we can access through Alt-Gr. Best is to swap the third and fourth positions on that key.
So your new layout will look like this:
// based on a keyboard map from an 'xkb/symbols/gb' file
// edited for UK on a US keyboard
default partial alphanumeric_keys
xkb_symbols "basic" {
// Describes the differences between a very simple en_US
// keyboard and a very simple U.K. keyboard layout defined by
// the SVR4 European Language Supplement and sometimes also
// known as the IBM 166 layout.
include "latin"
name[Group1]="English (UK)";
key { [ 3, numbersign, sterling, threesuperior ] };
key { [ 4, dollar, EuroSign, onequarter ] };
include "level3(ralt_switch_multikey)"
};
Don't edit the file in place, copy it somewhere else and edit it, and also keep a copy of the original to put back in case of error. When you re-install, or sometimes after an update, you will need to copy the file back over the top of the "official" one.
Going through the "latin" file, you might not be happy with many of the defaults. For example, Alt-Gr and q makes an @-sign, which is already on the keyboard. So you might want to put in a line as follows:
key { [ q, Q, infinity, Greek_OMEGA ] };
NOTE: Do not edit the "latin" file. This goes in the gb file. The less files edited the better! Of course, there is nothing to stop you copying a line from the "latin" file, pasting it into the gb file, then editing it. This will produce the infinity sign "∞" on Alt-Gr q. You don't need to know the name of the key you want to substitute, you can use the Unicode number (if 4 hex numbers) U221E, or for Unicode numbers above FFFF, you can use 0x1 followed by the 6-hex figure code, so, the infinity sign would be 0x100221E. You can redefine the third and fourth level keypresses for a number of keys if you wish. I have!
Just remember to keep the original just in case, and to back up the edited version so that you can restore it should the system overwrite it on an update.
Finally, if you're like me, you will have the CAPS LOCK key defined as the compose key, for 2 reasons. One is to get a compose key, and the other is to prevent you putting on CAPS LOCK in error. You can do this from the Control Centre in KDE, but with other desktops you can't. To put it right in the "gb" keyboard definition file, just add this line:
key { [ Multi_key ] };
Hope this helps someone!
----
Now that I have my keyboard, it is a mini- type and there are no keys for F11 and F12. However, there are two keys I really don't need: NumLock and Pause/Break. The thing is to go into BIOS and turn off startup numlock. Then into the PCLOS Control Centre, and turn off the NumLock background service. Finally, into your desktop settings and ensure that it turns NumLock off at startup.
Now set your keys in the "gb" file we discussed before:
key { [ F11 ] };
key { [ F12 ] };
Overall, the main section of the "gb" file will look like this:
// based on a keyboard map from an 'xkb/symbols/gb' file
// edited for UK on a US keyboard
default partial alphanumeric_keys
xkb_symbols "basic" {
// Describes the differences between a very simple en_US
// keyboard and a very simple U.K. keyboard layout defined by
// the SVR4 European Language Supplement and sometimes also
// known as the IBM 166 layout.
include "latin"
name[Group1]="English (UK)";
key { [ Multi_key ] };
key { [ F11 ] };
key { [ F12 ] };
key { [ 3, numbersign, sterling, threesuperior ] };
key { [ 4, dollar, EuroSign, onequarter ] };
key { [ q, Q, infinity, Greek_OMEGA ] };
include "level3(ralt_switch_multikey)"
};
And that, folks, is how Linux enables you to control your machine, and not the other way around!
|