LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 06-14-2008, 09:44 AM   #1
Frank616
Member
 
Registered: Dec 2004
Location: Canada
Distribution: Kubuntu, Fedora
Posts: 56

Rep: Reputation: 16
Creating custom keyboard definition file


Linux has pre-defined keyboard layouts for many languages, Russian, German, French, English, and many more. How can I create one that does not currently exist?

The language in question is Nuer, which is a Sudanese language. There are unicode fonts that have support for the Nuer language, and I can currently create documents in Nuer in OOo 2.4 on Kubuntu 8.04 using the US keyboard and the Insert | Special Characters function in OOo. This however, is quite tedious. I know what the layout for the Nuer keyboard should be as I have a picture of it. This keyboard does exist for Windows through the use of third-party software, but I no longer use Windows.

I now need a tutorial on how to create a custom keyboard definition for this language in Linux. Where do I begin?

Thanks.

Frank.


PS

I know that there are third party Linux solutions available as well, but Linux seems to have all the 'parts' already in place to create what I need, so I'd rather do it that way if I can.

Last edited by Frank616; 06-19-2008 at 10:43 PM. Reason: Solved!
 
Old 06-14-2008, 11:02 AM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,767

Rep: Reputation: 307Reputation: 307Reputation: 307Reputation: 307
This might help: http://www.linux.com/articles/113715
 
Old 06-14-2008, 04:51 PM   #3
Frank616
Member
 
Registered: Dec 2004
Location: Canada
Distribution: Kubuntu, Fedora
Posts: 56

Original Poster
Rep: Reputation: 16
BigRigDriver:

Thanks for that link. I've seen it before, and it is old, being dated in 2004. However, I see that there is an updated page that is linked on the one you sent me, and it is current to 2007. This may well be what I need.

Frank.
 
Old 06-14-2008, 05:26 PM   #4
DavidMcCann
Senior Member
 
Registered: Jul 2006
Location: London
Distribution: CentOS, Salix
Posts: 3,024

Rep: Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777
Have a look at
http://wiki.linuxquestions.org/wiki/..._Keyboard_Maps
 
Old 06-14-2008, 11:06 PM   #5
Frank616
Member
 
Registered: Dec 2004
Location: Canada
Distribution: Kubuntu, Fedora
Posts: 56

Original Poster
Rep: Reputation: 16
DavidMcCann:

Thanks for the additional link.

I spend several hours this afternoon going over the first link I received. While I successfully created a new keyboard file, and got KDE to see it, register it, and switch to it, I am now painfully going through the intricacies of the file structure itself. I've managed to decipher the way the 'variants' in the definition files are called, but I've not yet successfully been able to modify a key's behavior. I'll delve more into that tomorrow to see why my modifications did not 'take', even after a fresh login or a full reboot.

If anyone finds more information on the use of the alt and ctrl keys as modifier keys, I would appreciate that. I've yet to get that portion to work. There are 4 entries for each key: normal, shift, alt, and alt-shift. It is the last two that I haven't been able to get working yet in the US keyboard definition file that I started with. I wonder if there is some global that I have to set before the alt key modifier is accepted?

Frank.

Last edited by Frank616; 06-14-2008 at 11:07 PM.
 
Old 06-19-2008, 10:42 PM   #6
Frank616
Member
 
Registered: Dec 2004
Location: Canada
Distribution: Kubuntu, Fedora
Posts: 56

Original Poster
Rep: Reputation: 16
Solved! - Creating custom keyboard definition file Reply to Thread

OK, I hate the word 'cool' but this is just WAY COOL!

I was given this link. It is a bit of a tutorial on how to do what I was looking for. It not only gives some examples, but additional helpful links at the bottom.

By the way, this was all done in Kubuntu 8.04.

I copied the US keyboard file to another one called us_nuer (copy attached). I then loaded it. In KDE, this is done from Control Center | Regional and Language | Keyboard layout (or similar depending on your distro). Once this is enabled, you get a keyboard key in the kicker which you can click to change keyboard layouts.

In the us keyboard definition file there are several sections with alternate key layouts which one can select from the dropdown list box. I selected the us_intl variant as it has a lot of the keys I needed already redefined. The layout I needed to recreate is here and I began building it from the "us intl" variant.

A lot of it was pretty easy. Some of the keys I just redefined, like the 'q' I changed to show U014B and U014A which is the 'N' with the hook on it. OOo in the Insert | Special Characters menu choice opens up a list of all the glyphs available in the typeface you have selected. I just went through there, found the ones I needed, noted their unicode numbers, and redefined my keys with those unicode numbers.

If you look at the attached keyboard definition file in the section marked xkb_symbols "intl" you will see the changes I made. Any of the entries listed in unicode format (Uxxxx where x is a hex number) I put in there.

The really cool trick came however in trying to create the diaeresis (double dot over the letter) and macron below keys (an underline) on the comma and semicolon keys. There is no glyph in the typeface I am using (though it is created specifically for multilingual use) to give the backwards '3' with a diaeresis. I thought I was hooped until I could find another typeface. However....

Further down in that same attached file is another variant on the us keyboard called xkb_symbols "olpc" which I am guessing is from the One Laptop Per Child initiative. It has some strange numbers in there that creates one character from two by non-destructively backspacing and inserting the additional character. I have no idea how it does that, but it works. Notice, in the olpc variant, the line:

key <AE10> { [ 0, parenright, 0x1000308, 0x1000308 ] }; // combining diaeresis above

That number 0x1000308 non-destructively backspaces, then puts a double dot over the last character you typed! You can put a diaeresis over any character you can type, including numbers and symbols!

What I did was to move that 'magic number' to the comma key. However, note that this number is in the third column in that key definition line. That means that you have to press the alt key as a modifier to get the diaeresis, just like you would press the shift key to get the capital. So, on the comma key which I redefined in my section (intl), I get the comma, I get a double quote with shift-comma, and I get the diaeresis with alt-comma! I love it!

Interesting to note that some friends of ours bought a commercial keyboard program for Windows which is unable to create the diaeresis on the backwards '3' as there is no single glyph for it in the typeface.

Now, the only other thing I had to change was the modifier key. Normally in all these alternates in this file, there is a line at the bottom of each section that reads:

include "level3(ralt_switch)"

This means that the third level is reached with the Right Alt key (ralt). For me this is a pain, as the keys I want are typed with the right hand (comma and semicolon). It would be better if the modifier key were the Left Alt key. So, in my defintion, I change the last line to read:

include "level3(lalt_switch)"

Which makes the left alt key the modifier key. And it actually worked!!

It took some reading, and a bit of playing around for a few nights, but I now have a fully functional keyboard in the language I wanted -- and all with native Linux tools!

Ah, the joys of success!

Frank.

Oh -- a PS: If you try out this keyboard file, make sure you change back to your default keyboard before you shut down your machine or the screen saver kicks in and requires your password. If your password requires a character that was removed when the keyboard was redefined, you won't be able to key it in to reopen your account. I found out the hard way.

I later discovered that there is a way around this in KDE, as the login screen shows a button for the keyboard in use. You can change back to the default layout there before you put in your password.

-FB

PPS: I had to chop a lot out of the standare us keyboard definition file as it is too long for the forum software to accept it. What I have posted here may or may not work on your machine as I just chopped out what I THOUGHT was not necessary.

-FB

Code:
// $XKeyboardConfig: xkeyboard-config/symbols/us,v 1.42 2008-01-05 00:40:38 svu Exp $

//
// $XdotOrg: xc/programs/xkbcomp/symbols/us,v 1.1.4.3 2004/03/05 13:41:33 eich Exp $
// $XFree86: xc/programs/xkbcomp/symbols/us,v 1.6 2003/10/31 14:32:05 pascal Exp $

default
partial alphanumeric_keys modifier_keys 
xkb_symbols "basic" {

    name[Group1]= "USA";

    // Alphanumeric section
    key <TLDE> {	[     grave,	asciitilde	]	};
    key <AE01> {	[	  1,	exclam 		]	};
    key <AE02> {	[	  2,	at		]	};
    key <AE03> {	[	  3,	numbersign	]	};
    key <AE04> {	[	  4,	dollar		]	};
    key <AE05> {	[	  5,	percent		]	};
    key <AE06> {	[	  6,	asciicircum	]	};
    key <AE07> {	[	  7,	ampersand	]	};
    key <AE08> {	[	  8,	asterisk	]	};
    key <AE09> {	[	  9,	parenleft	]	};
    key <AE10> {	[	  0,	parenright	]	};
    key <AE11> {	[     minus,	underscore	]	};
    key <AE12> {	[     equal,	plus		]	};

    key <AD01> {	[	  q,	Q 		]	};
    key <AD02> {	[	  w,	W		]	};
    key <AD03> {	[	  e,	E		]	};
    key <AD04> {	[	  r,	R		]	};
    key <AD05> {	[	  t,	T		]	};
    key <AD06> {	[	  y,	Y		]	};
    key <AD07> {	[	  u,	U		]	};
    key <AD08> {	[	  i,	I		]	};
    key <AD09> {	[	  o,	O		]	};
    key <AD10> {	[	  p,	P		]	};
    key <AD11> {	[ bracketleft,	braceleft	]	};
    key <AD12> {	[ bracketright,	braceright	]	};

    key <AC01> {	[	  a,	A 		]	};
    key <AC02> {	[	  s,	S		]	};
    key <AC03> {	[	  d,	D		]	};
    key <AC04> {	[	  f,	F		]	};
    key <AC05> {	[	  g,	G		]	};
    key <AC06> {	[	  h,	H		]	};
    key <AC07> {	[	  j,	J		]	};
    key <AC08> {	[	  k,	K		]	};
    key <AC09> {	[	  l,	L		]	};
    key <AC10> {	[ semicolon,	colon		]	};
    key <AC11> {	[ apostrophe,	quotedbl	]	};

    key <AB01> {	[	  z,	Z 		]	};
    key <AB02> {	[	  x,	X		]	};
    key <AB03> {	[	  c,	C		]	};
    key <AB04> {	[	  v,	V		]	};
    key <AB05> {	[	  b,	B		]	};
    key <AB06> {	[	  n,	N		]	};
    key <AB07> {	[	  m,	M		]	};
    key <AB08> {	[     comma,	less		]	};
    key <AB09> {	[    period,	greater		]	};
    key <AB10> {	[     slash,	question	]	};

    key <BKSL> {	[ backslash,         bar	]	};
    key <CAPS> {	[ Caps_Lock	]	};
    // End alphanumeric section
};

partial alphanumeric_keys
xkb_symbols "euro" {

    name[Group1]= "USA - With EuroSign on 5";

    include "us(basic)"

    include "eurosign(5)"

    include "level3(ralt_switch)"
};


partial alphanumeric_keys
xkb_symbols "intl" {

    name[Group1]= "USA - International (with dead keys)";

    include "us(basic)"

    // Alphanumeric section
    key <TLDE> { [dead_grave, dead_tilde,         grave,       asciitilde ] };
    key <AE01> { [	   1,     exclam,    exclamdown,      onesuperior ] };
    key <AE02> { [	   2,         at,   twosuperior, dead_doubleacute ] };
    key <AE03> { [	   3, numbersign, threesuperior,      dead_macron ] };
    key <AE04> { [	   4,     dollar,      currency,         sterling ] };
    key <AE05> { [	   5,    percent,      EuroSign                   ] };
    key <AE06> { [    6, dead_circumflex,    onequarter,      asciicircum ] };
    key <AE07> { [	   7,  ampersand,       onehalf,	dead_horn ] };
    key <AE08> { [	   8,   asterisk, threequarters,      dead_ogonek ] };
    key <AE09> { [	   9,  parenleft, leftsinglequotemark, dead_breve ] };
    key <AE10> { [	   0, parenright, rightsinglequotemark, dead_abovering ] };
    key <AE11> { [     minus, underscore,   dead_macron,    dead_belowdot ] };
    key <AE12> { [     equal,       plus,      multiply,         division ] };

    key <AD01> { [	U014B,     U014A,    adiaeresis,       Adiaeresis ] };
    key <AD02> { [	   w,          W,         aring,            Aring ] };
    key <AD03> { [	   e,          E,        eacute,           Eacute ] };
    key <AD04> { [	   r,          R,    registered,       registered ] };
    key <AD05> { [	   t,          T,         thorn,            THORN ] };
    key <AD06> { [	   y,          Y,    udiaeresis,       Udiaeresis ] };
    key <AD07> { [	   u,          U,        uacute,           Uacute ] };
    key <AD08> { [	   i,          I,        iacute,           Iacute ] };
    key <AD09> { [	   o,          O,        oacute,           Oacute ] };
    key <AD10> { [	   p,          P,    odiaeresis,       Odiaeresis ] };
    key <AD11> { [ bracketleft,  braceleft,  guillemotleft, leftdoublequotemark ] };
    key <AD12> { [bracketright, braceright, guillemotright, rightdoublequotemark ] };

    key <AC01> { [	   a,          A,        aacute,           Aacute ] };
    key <AC02> { [	U0511,     U0510,        ssharp,          section ] };
    key <AC03> { [	   d,          D,           eth,              ETH ] };
    key <AC04> { [	U0263,     U0194,         U0263,            U0194 ] };
    key <AC08> { [	   k,          K,            oe,               OE ] };

    key <AC09> { [	   l,          L,        oslash,         Ooblique ] };
    key <AC10> { [ semicolon,      colon,     0x1000331,        0x1000331 ] };	//combining macron below
    key <AC11> { [apostrophe,   quotedbl,     0x1000308,        0x1000308 ] };	//combining diaeresis above

    key <AB01> { [	   z,          Z,            ae,               AE ] };
    key <AB02> { [	U0254,     U0186,         U0254,            U0186 ] };
    key <AB03> { [	   c,          C,     copyright,             cent ] };
    key <AB06> { [	   n,          N,        ntilde,           Ntilde ] };
    key <AB07> { [	   m,          M,            mu,               mu ] };
    key <AB08> { [     comma,       less,      ccedilla,         Ccedilla ] };
    key <AB09> { [    period,    greater, dead_abovedot,       dead_caron ] };
    key <AB10> { [     slash,   question,  questiondown,        dead_hook ] };
    key <BKSL> { [ backslash,        bar,       notsign,        brokenbar ] };

    include "level3(lalt_switch)"
};

partial alphanumeric_keys
xkb_symbols "olpc" {

   include "us(basic)"
   name[Group1]= "USA";

   // OLPC international US English keyboard layout.
   // It's a little different from the usual international layout.
   // See: http://wiki.laptop.org/go/Image:Keyboard_english.png

   key <TLDE> { [     grave, asciitilde,    dead_grave, dead_tilde ] };
   key <AE01> { [         1,     exclam,    exclamdown, exclamdown ] };
   key <AE02> { [         2,         at,       notsign,    notsign ] };
   key <AE03> { [         3, numbersign,     0x1000300,  0x1000300 ] }; // combining grave
   key <AE04> { [         4,     dollar,     0x1000301,  0x1000301 ] }; // combining acute
   key <AE05> { [         5,    percent,     0x1000306,  0x1000306 ] }; // combining breve above
   key <AE06> { [         6,asciicircum,     0x100030A,  0x100030A ] }; // combining ring above
   key <AE07> { [         7,  ampersand,     0x1000302,  0x1000302 ] }; // combining circumflex above
   key <AE08> { [         8,   asterisk,     0x100030C,  0x100030C ] }; // combining caron above
   key <AE09> { [         9,  parenleft,     0x1000307,  0x1000307 ] }; // combining dot above
   key <AE10> { [         0, parenright,     0x1000308,  0x1000308 ] }; // combining diaeresis above
   key <AE11> { [     minus, underscore,     0x1000304,  0x1000304 ] }; // combining macron above
   key <AE12> { [     equal,       plus,     0x1000303,  0x1000303 ] }; // combining tilde above

   key <AD01> { [         q,          Q,  Greek_omega, Greek_OMEGA ] };
   key <AD02> { [         w,          W,       oslash,      Oslash ] };
   key <AD03> { [         e,          E,           oe,          OE ] };
   key <AD04> { [         r,          R,    0x1000327,   0x1000327 ] }; // combining cedilla
   key <AD05> { [         t,          T,    0x100032E,   0x100032E ] }; // combining breve below
   key <AD06> { [         y,          Y,    0x1000325,   0x1000325 ] }; // combining ring below
   key <AD07> { [         u,          U,    0x100032D,   0x100032D ] }; // combining circumflex below
   key <AD08> { [         i,          I,    0x100032C,   0x100032C ] }; // combining caron below
   key <AD09> { [         o,          O,    0x1000323,   0x1000323 ] }; // combining dot below
   key <AD10> { [         p,          P,    0x1000324,   0x1000324 ] }; // combining diaeresis below
   key <AD11> { [ bracketleft,  braceleft,  0x1000331,   0x1000331 ] }; // combining macron below
   key <AD12> { [bracketright, braceright,  0x1000330,   0x1000330 ] }; // combining tilde below

   key <AC01>  { [         a,          A,          ae,               AE ] };
   key <AC02>  { [         s,          S,      ssharp,        0x1001E9C ] }; // uppercase S sharp
   key <AC03>  { [         d,          D,         eth,              ETH ] };
   key <AC04>  { [         f,          F,       thorn,            THORN ] };
   key <AC06>  { [         h,          H,    sterling,         sterling ] };
   key <AC07>  { [         j,          J,    EuroSign,         EuroSign ] };
   key <AC10>  { [ semicolon,      colon,   masculine,      ordfeminine ] };
   key <AC11>  { [ apostrophe,  quotedbl,    currency,         currency ] };
   key <BKSL>  { [ backslash,        bar,      section,         section ] };

   key <AB03>  { [         c,          C,    ccedilla,         Ccedilla ] };
   key <AB06>  { [         n,          N,      ntilde,           Ntilde ] };
   key <AB07>  { [         m,          M,          mu,               mu ] };
   key <AB08>  { [     comma,     less,  guillemotleft,   guillemotleft ] };
   key <AB09>  { [    period,  greater, guillemotright,  guillemotright ] };
   key <AB10>  { [     slash,   question, questiondown,    questiondown ] };

   key <I219>  { [  multiply,   division, ISO_Next_Group, ISO_Prev_Group ] };

   include "level3(ralt_switch)"
};

partial alphanumeric_keys
xkb_symbols "olpc2" {
   include "us(olpc)"
   name[Group1]= "USA - Group toggle on multiply/divide key";
   key <I219>  { [ ISO_Next_Group, ISO_Prev_Group ] };
};
 
  


Reply

Tags
keyboard, layout


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
Creating custom headers to match a custom kernel utanja Debian 2 06-08-2007 03:15 PM
Creating a Custom Kernel BlackSheep024 Ubuntu 3 06-05-2007 08:55 PM
Creating a custom distrobution xaos5 Linux - General 1 03-06-2007 10:12 PM
Creating a custom process id cbutcher Linux - General 2 04-29-2005 06:59 AM
creating custom locale jinujose Linux - General 1 10-21-2003 12:50 AM


All times are GMT -5. The time now is 05:15 AM.

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