Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-13-2011, 11:01 AM   #1
LQ Newbie
Registered: Mar 2011
Posts: 9

Rep: Reputation: 0
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:

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?



Last edited by naena; 03-13-2011 at 11:06 AM.
Old 03-13-2011, 11:07 AM   #2
David the H.
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

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

I'm not sure about the console keyboard, however.
Old 03-13-2011, 01:02 PM   #3
Senior Member
Registered: Jul 2006
Location: London
Distribution: CentOS, Salix
Posts: 4,306

Rep: Reputation: 1294Reputation: 1294Reputation: 1294Reputation: 1294Reputation: 1294Reputation: 1294Reputation: 1294Reputation: 1294Reputation: 1294
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:
Old 03-22-2011, 12:31 AM   #4
LQ Newbie
Registered: Mar 2011
Posts: 9

Original Poster
Rep: Reputation: 0
I fixed it!
I first followed this doc:

Well, this is what is going on:
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)
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'
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.
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)
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)

Last edited by naena; 03-22-2011 at 09:05 AM. Reason: Minor: Corrected shifted states list and some
Old 03-22-2011, 01:51 AM   #5
LQ Newbie
Registered: Mar 2011
Posts: 9

Original Poster
Rep: Reputation: 0
I fixed it. Here's how

Thanks to Pascal:

What I learned:
etc/X11/xkb/symbols/pc has definition of physical layout of different keyboards
e.g. US, IN, LK.
Each keyboard has a default set and its variations below it. e.g. US has 'basic', 'intl', 'alt-intl' and 'rus'. I added 'sinhala'
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.
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:
include "level3(ralt_switch)" means we are using AltGr key at the third position of a key definition row.
Key positions in a row: Unshifted, Shifted, AltGr, Ctrl
e.g. key <AB08> { [ comma, less, ccedilla, Ccedilla ] };
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.
A typo will cause you unable to type anything with the new layout.
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)
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.***
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.
Attached Files
File Type: txt us.txt (15.8 KB, 12 views)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
keyboard map : not as I think it should be esteeven Linux - General 3 03-13-2011 01:19 PM
Keyboard Map UltraSoul *BSD 1 02-08-2005 11:21 AM
keyboard map logicport Linux - Software 1 07-26-2004 11:45 PM
Keyboard map? Gerardoj Linux - Hardware 0 09-29-2003 09:46 PM
Keyboard Map Gerardoj Linux - General 2 08-07-2003 02:57 PM

All times are GMT -5. The time now is 02:48 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration