Linuxdoc Linux Questions
Click here to ask our community of linux experts!
Custom Search

3. Keyboard

3.1. Using The Bijoy Keyboard

In X Window, all the keyboard related stuff is handled by XKB. XKB relies on some configuration files called the "symbol" files, to get the layout of a specific keyboard. The following steps describe the installation process of a symbol file for the Bijoy Bangla keyboard:

  1. Below is the symbol file for the Bijoy keyboard. Save it as bn_bijoy .

    
             
    
    // Symbol file for the Bijoy Bangla Keyboard.
    
    
    partial default alphanumeric_keys
    xkb_symbols "bijoy" {
    
    name[group2]="Bangla";
    
    
    key <AE01> { [], [     49,      exclam ] };
    key <AE02> { [], [     50,      64  ]  };
    key <AE03> { [], [     51,      35  ]  };
    key <AE04> { [], [     52,      36  ]  };
    key <AE05> { [], [     53,      37  ]  };
    key <AE06> { [], [     54,      94  ]  };
    key <AE07> { [], [     55,      117 ]  };
    key <AE08> { [], [     56,      asterisk ] };
    key <AE09> { [], [     57,      parenleft ] };
    key <AE10> { [], [     48,      parenright ] };
    key <AE11> { [], [     minus,   209        ] };
    key <AE12> { [], [     61,      plus ]  };
    key <AD01> { [], [     79,      115  ]  };
    key <AD02> { [], [     104,     113  ]  };
    key <AD03> { [], [     87,      88   ]  };
    key <AD04> { [], [     99,      100  ]  };
    key <AD05> { [], [     85,      86   ]  };
    key <AD06> { [], [     80,      81   ]  };
    key <AD07> { [], [     82,      83   ]  };
    key <AD08> { [], [     110,     84   ]  };
    key <AD09> { [], [     77,      78   ]  };
    key <AD10> { [], [     111,     112  ]  };
    key <AD11> { [], [     bracketleft,  braceleft ]};
    key <AD12> { [], [     bracketright, braceright]};
    key <AC01> { [], [     U84,     169  ]  };
    key <AC02> { [], [     121,     126  ]  };
    key <AC03> { [], [     119,     120  ]  };
    key <AC04> { [], [     118,     65   ]  };
    key <AC05> { [], [     Multi_key,      124  ]  };
    key <AC06> { [], [     101,     102  ]  };
    key <AC07> { [], [     75,      76   ]  };
    key <AC08> { [], [     90,      95   ]  };
    key <AC09> { [], [     96,      97   ]  };
    key <AC10> { [], [  semicolon,  colon]  };
    key <AC11> { [], [     213,     211  ]  };
    key <TLDE> { [], [     212,     210  ]  };
    key <BKSL> { [], [     114,     116  ]  };
    key <AB01> { [], [     170,     168  ]  };
    key <AB02> { [], [     73,      U8a  ]  };
    key <AB03> { [], [     U87,     U89  ]  };
    key <AB04> { [], [     105,     106  ]  };
    key <AB05> { [], [     98,      89   ]  };
    key <AB06> { [], [     109,     108  ]  };
    key <AB07> { [], [     103,     107  ]  };
    key <AB08> { [], [     comma,   less ]  };
    key <AB09> { [], [     period,  greater]};
    key <AB10> { [], [     slash,  question]};
    
    } ;
    
                
              
    
  2. Copy bn_bijoy to /usr/X11R6/lib/X11/xkb/symbols/

  3. Edit the "InputDevice" section of XF86Config so it looks like:

    
.........
    .........
    
    Section "InputDevice"
            Identifier  "Keyboard0"
            Driver      "keyboard"
    
            Option   "XkbKeycodes"   "xfree86"
            Option   "XkbTypes"      "complete"
            Option   "XkbCompat"     "complete+leds"
            Option   "XkbSymbols"    "us(pc104)+bn_bijoy+group(lwin_toggle)"
            Option   "XkbGeometry"   "pc(pc104)"
    EndSection
    ..........
    ..........
    
              
    

    The above description is for a 104-key keyboard.

  4. Restart X server by pressing Ctrl+Alt+Bksp.

  5. After restarting X, the Bijoy keyboard should be present along side the English one. To activate it, press the left Win-key. If everything is okay, the Scroll Lock LED will be on and the key presses will produce codes according to the Bijoy keyboard layout. Pressing the left Win-key again will disable Bijoy and the Scroll Lock LED will go off.

  6. To test the newly installed Bijoy keyboard, follow these steps:

    1. Open KWord,

    2. Select sutonnymj from the font list,

    3. Press the left Winkey,

    4. Start typing according to the Bijoy keyboard layout.

  7. A handy tool for testing mouse and keypress events is xev. This program shows all the generated codes from keypresses.

These steps are not enough, however, to write ligatures or compound characters. The next section describes this very thing.

3.2. Writing Ligatures

The ligature writing process described here is not a standard one . At best it can be called a work-around (it has a similarity to cuckoos laying eggs in crows' nests). If this method is used, the "Multikey" feature won't work on Latin characters (at least when Bijoy keyboard is needed). If there is no need to use the Multikey for typing various Latin characters like "ssharp" then this method is okay. The typing sequence of characters for writing ligatures is slightly different from the the original Bijoy keyboard. Whatever is the situation, the following steps describe a way to get the ligatures to appear on the screen:

  1. Save the following as Compose.bijoy:

    
            
    
    # Compose File for the Bijoy Bangla Keyboard
    #
    # Sequence Definition
    #
    # <Multi_key> Means <Compose>
    # Special Character
    
    # Special
    <Multi_key> <Multi_key>                 : "\46"
    
    # Ka
    <Multi_key> <K> <K>                     : "\260"
    <Multi_key> <O> <K>                     : "\274"
    <Multi_key> <j> <K>                     : "\351"
    <Multi_key> <l> <K>                     : "\256\213"
    <Multi_key> <m> <K>                     : "\257\213"
    
    # Kha
    
    <Multi_key> <O> <L>                     : "\225\114"
    <Multi_key> <m> <L>                     : "\366"
    
    # Ga
    <Multi_key> <M> <M>                     : "\271"
    <Multi_key> <O> <M>                     : "\275"
    <Multi_key> <grave> <M>                 : "\230\115"
    <Multi_key> <j> <M>                     : "\352"
    <Multi_key> <o> <M>                     : "\377"
    
    #Gha
    <Multi_key> <O> <N>                     : "\225\116"
    <Multi_key> <grave> <N>                 : "\230\116"
    
    # Cha
    <Multi_key> <P> <P>                     : "\224\120"
    <Multi_key> <T> <P>                     : "\302"
    <Multi_key> <k> <P>                     : "\360"
    
    # Chha
    <Multi_key> <P> <Q>                     : "\224\121"
    <Multi_key> <T> <Q>                     : "\303"
    
    # Ja
    <Multi_key> <R> <R>                     : "\276"
    <Multi_key> <T> <R>                     : "\304"
    <Multi_key> <e> <R>                     : "\342"
    
    # Jha
    <Multi_key> <R> <S>                     : "\300"
    <Multi_key> <T> <S>                     : "\305"
    
    # Io
    <Multi_key> <R> <T>                     : "\301"
    
    # Ta
    <Multi_key> <K> <U>                     : "\261"
    <Multi_key> <U> <U>                     : "\306"
    <Multi_key> <Y> <U>                     : "\310"
    <Multi_key> <b> <U>                     : "\233\125"
    <Multi_key> <c> <U>                     : "\336"
    <Multi_key> <j> <U>                     : "\353"
    <Multi_key> <l> <U>                     : "\363"
    <Multi_key> <m> <U>                     : "\367"
    
    # Tha
    <Multi_key> <Y> <V>                     : "\311"
    <Multi_key> <b> <V>                     : "\332"
    <Multi_key> <l> <V>                     : "\364"
    
    # Da
    <Multi_key> <W> <W>                     : "\307"
    <Multi_key> <Y> <W>                     : "\312"
    <Multi_key> <b> <W>                     : "\333"
    <Multi_key> <j> <W>                     : "\354"
    
    # Nna
    <Multi_key> <l> <Y>                     : "\362"
    <Multi_key> <n> <Y>                     : "\156\350"
    
    # Ta
    <Multi_key> <K> <Z>                     : "\263"
    <Multi_key> <Z> <Z>                     : "\313"
    <Multi_key> <b> <Z>                     : "\232\227"
    <Multi_key> <c> <Z>                     : "\337"
    <Multi_key> <m> <Z>                     : "\257\227"
    
    # Tha
    <Multi_key> <Z> <underscore>            : "\314"
    <Multi_key> <b> <underscore>            : "\232\222"
    <Multi_key> <m> <underscore>            : "\257\222"
    
    # Dda
    <Multi_key> <M> <grave>                 : "\272"
    <Multi_key> <grave> <grave>             : "\317"
    <Multi_key> <b> <grave>                 : "\233\140"
    <Multi_key> <e> <grave>                 : "\343"
    
    # Dha
    <Multi_key> <M> <a>                     : "\273"
    <Multi_key> <grave> <a>                 : "\327"
    <Multi_key> <b> <a>                     : "\334"
    <Multi_key> <e> <a>                     : "\344"
    
    # Na
    <Multi_key> <K> <b>                     : "\113\350"
    <Multi_key> <M> <b>                     : "\115\350"
    <Multi_key> <N> <b>                     : "\116\350"
    <Multi_key> <Y> <b>                     : "\131\350"
    <Multi_key> <Z> <b>                     : "\132\350"
    <Multi_key> <b> <b>                     : "\142\234"
    <Multi_key> <c> <b>                     : "\143\350"
    <Multi_key> <g> <b>                     : "\346"
    <Multi_key> <k> <b>                     : "\153\350"
    <Multi_key> <m> <b>                     : "\370"
    <Multi_key> <n> <b>                     : "\375"
    
    # Pa
    <Multi_key> <c> <c>                     : "\340"
    <Multi_key> <g> <c>                     : "\244\143"
    <Multi_key> <j> <c>                     : "\355"
    <Multi_key> <l> <c>                     : "\256\143"
    <Multi_key> <m> <c>                     : "\257\143"
    
    # Pha
    <Multi_key> <g> <d>                     : "\347"
    <Multi_key> <j> <d>                     : "\356"
    <Multi_key> <l> <d>                     : "\365"
    <Multi_key> <m> <d>                     : "\371"
    
    # Ba
    <Multi_key> <K> <e>                     : "\113\241"
    <Multi_key> <M> <e>                     : "\115\246"
    <Multi_key> <R> <e>                     : "\122\241"
    <Multi_key> <U> <e>                     : "\125\241"
    <Multi_key> <Y> <e>                     : "\131\136"
    <Multi_key> <Z> <e>                     : "\132\241"
    <Multi_key> <underscore> <e>            : "\137\241"
    <Multi_key> <grave> <e>                 : "\330"
    <Multi_key> <a> <e>                     : "\141\237"
    <Multi_key> <b> <e>                     : "\233\136"
    <Multi_key> <e> <e>                     : "\145\237"
    <Multi_key> <g> <e>                     : "\244\136"
    <Multi_key> <j> <e>                     : "\152\246"
    <Multi_key> <k> <e>                     : "\153\246"
    <Multi_key> <m> <e>                     : "\257\136"
    <Multi_key> <n> <e>                     : "\156\237"
    
    # Bha
    <Multi_key> <grave> <f>                 : "\231\242"
    <Multi_key> <g> <f>                     : "\244\242"
    
    # Ma
    <Multi_key> <K> <g>                     : "\264"
    <Multi_key> <M> <g>                     : "\115\245"
    <Multi_key> <O> <g>                     : "\225\147"
    <Multi_key> <U> <g>                     : "\125\245"
    <Multi_key> <Z> <g>                     : "\315"
    <Multi_key> <grave> <g>         : "\331"
    <Multi_key> <a> <g>                     : "\141\245"
    <Multi_key> <b> <g>                     : "\142\245"
    <Multi_key> <g> <g>                     : "\244\247"
    <Multi_key> <j> <g>                     : "\152\245"
    <Multi_key> <k> <g>                     : "\153\245"
    <Multi_key> <l> <g>                     : "\256\247"
    <Multi_key> <m> <g>                     : "\257\247"
    <Multi_key> <n> <g>                     : "\376"
    
    # La
    <Multi_key> <K> <j>                     : "\113\254"
    <Multi_key> <M> <j>                     : "\115\254"
    <Multi_key> <c> <j>                     : "\143\254"
    <Multi_key> <d> <j>                     : "\144\254"
    <Multi_key> <e> <j>                     : "\145\254"
    <Multi_key> <f> <j>                     : "\146\254"
    <Multi_key> <g> <j>                     : "\244\254"
    <Multi_key> <j> <j>                     : "\152\254"
    <Multi_key> <l> <j>                     : "\153\254"
    <Multi_key> <m> <j>                     : "\257\254"
    <Multi_key> <n> <j>                     : "\156\254"
    
    # Ssa
    <Multi_key> <K> <l>                     : "\266"
    
    # Sa
    <Multi_key> <K> <m>                     : "\267"
    <Multi_key> <b> <m>                     : "\335"
    <Multi_key> <c> <m>                     : "\341"
    
    # Miscellaneous
    <Multi_key> <K> <ordfeminine>           : "\265"
    <Multi_key> <Z> <ordfeminine>           : "\316"
    <Multi_key> <f> <ordfeminine>           : "\345"
    <Multi_key> <n> <U84>                   : "\374"
    <Multi_key> <M> <y>                     : "\270"
    <Multi_key> <i> <y>                     : "\151\223"
    <Multi_key> <k> <y>                     : "\357"
    <Multi_key> <n> <y>                     : "\373"
    <Multi_key> <i> <asciitilde>            : "\151\203"
    
    # Vowels
    <Multi_key> <w>                         : "\102"
    <Multi_key> <x>                         : "\103"
    <Multi_key> <y>                         : "\104"
    <Multi_key> <y>                         : "\104"
    <Multi_key> <asciitilde>                : "\105"
    <Multi_key> <U84>                       : "\106"
    <Multi_key> <U87>                       : "\107"
    <Multi_key> <U89>                       : "\110"
    <Multi_key> <U8a>                       : "\112"
    
    
    # End of Sequence Definition
    
                
              
    
  2. Get the current locale name. One way to get it is:

     
    
  $ echo $LANG 
              
    
  3. Find the Compose file for the current locale. /usr/X11R6/lib/X11/locale/compose.dir lists the Compose files for all the locales. If the locale is "C", the Compose file is iso8859-1/Compose, i.e. /usr/X11R6/lib/X11/locale/iso8859-1/Compose. If the locale is "en_US.ISO8859-15," the Compose file is iso8859-15/Compose, i.e. /usr/X11R6/lib/X11/locale/iso8859-1/Compose. Whichever is the Compose file for the current locale, make a backup of it:

     
    
  $ cd /usr/X11R6/lib/X11/locale/iso8859-1/ 
    
  $ mv Compose Compose.real 
              
    

    The above example commands were written assuming that the locale was "C."

  4. Make Compose.bijoy the new Compose file for the current locale:

     
    
  $ cp Compose.bijoy /usr/X11R6/lib/X11/locale/iso8859-1/Compose
              
    

    The above example command was written assuming that the locale was "C."

  5. The ligatures can be written now. To test it do the following:

    1. Open KWord,

    2. Select sutonnymj from the font list,

    3. Press the left Winkey,

    4. Press 'Hashanta'(g)+'Ka'(j)+'Ka'(j).

    If the output is Zukta Ka, then the ligature writing process is okay. Now the thing to notice here is that, unlike the original Bijoy keyboard, Hashanta has been pressed before the two 'Ka's. The original Bijoy keyboard requires that 'Hashanta' be pressed in the midst of the two 'Ka's, for example:

    Zukta Ka = 'Ka'(j)+'Hashanta'(g)+'Ka'(j)

    Except this change of sequence for writing ligatures there are a few minor ones that have been listed below:

    Original Sequence Changed Sequence
    'Ka'(j)+'Rafala'(z) 'Hashanta'(g)+'Ka'(j)+'Rafala'(z)
    'Ta'(k)+'Rafala'(z) 'Hashanta'(g)+'Ta'(k)+'Rafala'(z)
    'Va'(H)+'Rafala'(z) 'Hashanta'(g)+'Va'(H)+'Rafala'(z)
    'Ha'(i)+'Rikar'(a) 'Hashanta'(g)+'Ha'(i)+'Rikar'(a)
    'Ga'(o)+'Ukar'(s) 'Hashanta'(g)+'Ga'(o)+'Ukar'(s)
    'Ra'(v)+'Ukar'(s) 'Hashanta'(g)+'Ra'(v)+'Ukar'(s)
    'Sha'(M)+'Ukar'(s) 'Hashanta'(g)+'Sha'(M)+'Ukar'(s)
    'Ha'(i)+'Ukar'(s) 'Hashanta'(g)+'Ha'(i)+'Ukar'(s)
    'Ra'(v)+'UUkar'(S) 'Hashanta'(g)+'Ra'(v)+'UUkar'(S)