Customizing Input Methods in Solaris and OpenSolaris

Customizing IIIM (Internet/Intranet Input Methods) in Solaris & OpenSolaris

A frequently asked question these days is how to customize IIIM (Input Methods) in OpenSolaris; it is difficult to find any value information on how to work with or how to modify the IIIM. There are some projects being developed to make IIIM more user-friendly but most probably they wont be finished soon, or at least they have not been finished yet.

I played a bit with IIIM data on my installed system and I was able to customize my keyboard layout with Input Methods; it might not be a very elegant way how to do it, but it works and it is very easy to do, so here is it:

Source for symbols used by IIIMF is stored in the following file:

/etc/iiim/layoutdata.xml

with the following format:

<lo type="LANGUAGE">
<key sym="KEYCODE">
<c1>UNICODE</c1>
<c2>UNICODE</c2>
<c3>UNICODE</c3>
<c4>UNICODE</c4>
</key>
</lo>

where:
  • LANGUAGE is the name of the keyboard layout e.g Estonian, French, Hungarian, Czech, etc....
  • KEYCODE is the code for the key according:
  • UNICODE is the Unicode for the symbol required (Unicode)
  • c1 - c4 is the position of the symbols on each key of the keyboard

  • c1   -   Group1   -   layer 1   -   "key"

    c2   -   Group2   -   layer 2   -   "SHIFT" + "key"

    c3   -   Level1   -   layer3   -   "AltGr" + "key"

    c4   -   Level2   -   layer4   -   "AltGr" + "SHIFT" + "key"

Well, now that we understand the synopsis of "layoutdata.xml"; we just need to open the '/etc/iiim/layoutdata.xml' file with the appropriate program and edit it. To make it easier to work with this file, you can use the following command which will create a new human-readable file:

# cat /etc/iiim/layoutdata.xml | perl -pe 's/\\ /\\n/g' > /tmp/layoutdata_modified

The command above will generate "/tmp/layoutdata_modified" file.

-------

As an example I will show how I changed my Slovak Keyboard Layout into a Slovak_qwerty kb layout.

  1. Backup layoutdata.xml file:
  2. # [ ! -f /etc/iiim/layoutdata.xml_BackUp ] &⁞& cp /etc/iiim/layoutdata.xml /etc/iiim/layoutdata.xml_BackUp
  3. Modify layoutdata.xml file to make it easier to work with:
  4. # cat /etc/iiim/layoutdata.xml | perl -pe 's/\\ /\\n/g' > /tmp/layoutdata_modified
  5. Use 'vim' (or your preferred text editor) to edit  "/tmp/layoutdata_modified"
  6. # vim /tmp/layoutdata_modified 

  7. Modify the entry for "Y" and "Z" letters. 
  8. (The only difference between Slovak and Slovak-qwerty kb layouts is the position of the "Y" and "Z" letters; so the only think I need to do is simply modify the entry for <AD06> and for <AB01>).

    Before the change:

    ...
         

    sym="AB01"><c1>79</c1><c2>59</c2><c3>3e</c3><c4>3e</c4><code>59</code><altcode>a0</altcode></key><key

    sym="AD06">⁞<c1>7a</c1><c2>5a</c2><code>5a</code></key><key

    ...

    After the change:

    ...
        

    sym="AB01"><c1>7a</c1><c2>5a</c2><c3>3e</c3><c4>3e</c4><code>5a</code><altcode>a0</altcode></key><key

    sym="AD06"><c1>79</c1><c2>59</c2><code>59</code></key><key

    ...
  9. Do not forget to convert the file to its old format:
  10. # cat /tmp/layoutdata_modified | perl -pe 's/\\n/\\ /g' > /tmp/layoutdata_formated 

  11. Copy back the modified file to its original location:
  12. # cp /tmp/layoutdata_formated /etc/iiim/layoutdata.xml



 
  

Comments:

Great post! Very clear and easy to understand. And very usefull.

Posted by Denver on March 14, 2009 at 06:39 AM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Solaris l10n & i18n, locales, keyboards, fonts and related topics.

Search

Archives
« July 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today