Author Topic: keyboard layout howto  (Read 486 times)

AndyVIII

  • Guest
keyboard layout howto
« on: December 28, 2010, 03:49:28 AM »
PCLinuxOS LXDE 2010.12
I use a local keyboard with us and Thai layout.
The us layout is ok for me, but I like to have some
additional german characters like "äöü ÄÖÜ"
This can easy be implemented with xmodmap, but if
you switch to the second layout, you will observe
some strange results.

After plenty of  googling, I found an IMHO easy and
perfect solution: create and use your custom keyboard!

1) /usr/share/X11/xkb/symbols/
   choose your nearest preference, in my case "us"
   and save it with a new name: "us-de"

2) delete anything, which you don't need, and change,
   what ever you like. My file for "us-de":
-----------
default
xkb_symbols "basic" {

    name[Group1]= "ASCII with german";

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

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

    key <AC01> {   [ a, A, adiaeresis, Adiaeresis   ]   };
    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, mu            ]   };
    key <AB08> {   [     comma,   less      ]   };
    key <AB09> {   [    period,   greater      ]   };
    key <AB10> {   [     slash,   question   ]   };

    key <BKSL> {   [ backslash,         bar   ]   };
    key <CAPS> {        [ VoidSymbol         ]       };

    // End alphanumeric section
    include "level3(ralt_switch)"
};
-----------

3) /usr/share/X11/xkb/compiled
   delete here any file to remove any hystory.

4) in "Configure your Computer" you can not choose two keyboards.
   To enable this, edit
   /etc/xdg/lxsession/LXDE/autostart
   append after the last line:
   setxkbmap -layout "us-de,th"

remark:
   this could also be done in
   /etc/sysconfig/keyboard
   but any use of "Configure your Computer" will overwrite it.

5) add a "Keyboard Layout Switcher" to your panel

I post this, as it is easy to do, but difficult to find out,
and perhaps to make somebody happy...
Feedback and hints to improve are welcome!

« Last Edit: December 28, 2010, 03:57:59 AM by AndyVIII »

Offline Webt

  • Full Member
  • ***
  • Posts: 180
Re: keyboard layout howto
« Reply #1 on: December 28, 2010, 11:04:22 AM »
This may be REALLY teaching grandma to suck eggs but ... I used system - preferences - keyboard - layouts to get the French and German characters I require ... of course as it changes the keyboard layout, you have to know the French and German keyboard layouts already (e.g. 123 becomes &é" in French, and [;' becomes üöä in German, not to mention the z and y keys transposed). Sorry if everyone knew this already.
PCLinuxOS, Gnome, LXDE; AMD Dual Core Processor 4850B ‎512 KB ‎2500 MHz; Seagate 500418AS; FreeAgentDesktop external drive; PHILIPS DVDR1628P1; GeForce 6150SE nForce 430; HP Photosmart. PASS April 2012. Still learnin' Linux. If I have offended, please note: I am a professor of dontopedalogy.

uncleV

  • Guest
Re: keyboard layout howto
« Reply #2 on: December 28, 2010, 11:09:54 AM »
AndyVIII,
thanks for the tip :)