LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Editing / making a keyboard map (https://www.linuxquestions.org/questions/linux-newbie-8/editing-making-a-keyboard-map-868303/)

naena 03-13-2011 11:01 AM

Editing / making a keyboard map
 
Hello all,

I am just entering the Linux world. All these years I wanted to test Linux but did not have the resources to make a new computer. Then I found Puppy Linux by chance. Nearly all the work I do with Windows 7/XP can be done with Puppy Linux. I am running it from a CD.

I developed a smartfont for an Indic language called Sinhala, which uses ISO-8859-1 (Latin-1, SBCS) character set. It makes typing Sinhala, one of the more complex of Indic scripts, easy.

Essentially, this is a transliteration of the 'complex' script into Latin character set and then showing it back in the native script by way of the smartfont. See it here:
http://lovatasinhala.com/

Of course, you have no clue what it says. If you copy the text and look, you'll understand what is going on. You can type it with the dead-key keyboard. Only problem is that in certain situations, the font makes conjoint letters where you don't want them. You can prevent it by inserting the ZWNJ, Zero-width non-joiner (u200C), but the keyboard does not have it. Is there a way to edit the keyboard layout and make a modified key layout?

Thanks.

naena

David the H. 03-13-2011 11:07 AM

I've not yet done much with it myself, but you can read all about how the X keyboard works here:

http://www.charvolant.org/~doug/xkb/html/xkb.html

I'm not sure about the console keyboard, however.

DavidMcCann 03-13-2011 01:02 PM

I may be wrong here, but I don't think this is going to work with Puppy. If it does, please tell us how: I could never get a custom keyboard with Puppy.

Most distros compile the keyboard driver after the user logs in, so that it can be tailored to that user's configuration options. Puppy, as a single-user system, seems to have pre-compiled drivers, like Windows. I could never work out how to create them.

Puppy is a very English-oriented distro. If you had one with better support for Asian languages, you'd find that you'd get a Sinhalese keyboard.

The problem with your approach is that it's what we used to do back in the 80's. Using the modern approach, where the script has its proper place in unicode, means that your files would be accessible to other people, without their needing your special font.

Have a look here:
http://www.linuxquestions.org/questi...on-linux-2570/

naena 03-22-2011 12:31 AM

I fixed it!
I first followed this doc:
http://hektor.umcs.lublin.pl/~mikosm...youts-xkb.html

Well, this is what is going on:
1.
The files at etc/X11/xkb/symbols/pc define arrangements of keys in different physical keyboards. Make your layout (variation) under the name of the physical keyboard that it applies to (see 2 next)
2.
Each of these have a basic set and then variations below it. e.g. in the 'US' keyboard file, we have 'basic', 'intl', 'alt-intl', 'Dvorak', 'rus'
3.
Each key has its own name either as a nick name like <BKSL> for Backslash or according to its position like <AD03> for 'e' meaning, A=alphanumeric; D=the 4th row counting from the key row having the space bar (being A), row with Shift key being B etc. These names are assigned somewhere that I could not find. Notice however, that the Russian one uses names like <LatA> which are different to this rule.
4.
Each type of key is categorized into how many shifted states it can take. e.g. Enter key has only one shifted state, but an alphabetic like 'a' can have four (Unshifted, Shift, AltGr and Ctrl)
5.
All resulting characters have there own name defined somewhere, which too I could not locate. e.g. &=ampersand, Left Parentheses = parenleft

=============
Okay, my problem was:
I want to define a keymap that incorporates ZWNJ (Zero width non-joiner) which is Unicode code point u200C. What is it's given name in Ubuntu? (I have version 10.4 code name Lucid).

Pascal says you could use the Unicode notation u200C, but it did not work! After days of testing I noticed that changes do not stick and you are reverted to the old layout. So, I looked around under XKB if there is anything that was caused to be written by me (checking the file dates). There were number of files in side etc/X11/xkb/compiled folder. Actually, that is a link to a folder elsewhere. I deleted the files and my keyboard worked as soon as an X server Restart!

Change your keyboard to something other than the one you are editing. Otherwise it would be read-only. I edited US while in UK. I believe that we do not need to use all the silly names of keys. Instead, we can be a bit modern and use Unicode codepoints like this:
key <AD01> { [ u0071, u0051, u00E4, u00C4 ] };
is same as:
key <AD01> { [ q, Q, adiaeresis, Adiaeresis ] };

(I accidentally saved this, but thought I lost it. Then I wrote the next one. Both these posts say essentially the same thing)

naena 03-22-2011 01:51 AM

I fixed it. Here's how
 
1 Attachment(s)
Thanks to Pascal:
http://hektor.umcs.lublin.pl/~mikosm...youts-xkb.html

What I learned:
1.
etc/X11/xkb/symbols/pc has definition of physical layout of different keyboards
e.g. US, IN, LK.
2.
Each keyboard has a default set and its variations below it. e.g. US has 'basic', 'intl', 'alt-intl' and 'rus'. I added 'sinhala'
3.
Each key has a nick name (e.g. <BKSL> for Backslash, or one made according to type and position. e.g. <AE03>: A=alphanumeric; E=Fifth row from the row having the space bar (=A), 03=third alphanumeric key counting from left.
3.
Each character produced has an assigned name defined somewhere that I could not find. e.g. $=dollar. 3=3, -=minus
We can use the Unicode codepoint for each of the characters like $=u0024, 3=u0033, -=u002D
Unicode code points: http://www.unicode.org/charts/
4.
include "level3(ralt_switch)" means we are using AltGr key at the third position of a key definition row.
5.
Key positions in a row: Unshifted, Shifted, AltGr, Ctrl
e.g. key <AB08> { [ comma, less, ccedilla, Ccedilla ] };
6.
Stay in a different keyboard than the one you are editing. Otherwise, the definition file would be read-only.
e.g. Use UK when editing US.
7.
A typo will cause you unable to type anything with the new layout.
8.
Mostly, you are making a layout variant under a given physical keyboard. Therefore, if the physical keyboard you are using is the US keyboard, add your definition to the US file. (See the attachment)
9.
When you have finished editing, delete the files in the 'compiled' folder:
(Puppy Linux:) etc/X11/xkb/compiled
***This step is important to avoid days of frustration.***
10.
Restart X server and set up the Keyboard and the new variant you made.
e.g.. (Puppy Linux:) Menu -> Setup -> Mouse/Keyboard wizard ->
Chose layout... -> Advanced Xorg... -> Layout Variants
(read instructions carefully. You might set the wrong variant if not careful.

See the attachment for my work -- the bottom most one. Actually, it ('sinhala') defers from 'intl' only in the bottom two rows.

Thank you for the responses. It took me days to figure out all this. So pardon me for late return here.


All times are GMT -5. The time now is 06:07 PM.