To type Hausa and Kanuri letters like ə, Ɓ or ƙ you will need to modify your keyboard layout. A keyboard layout maps the buttons on the keyboard to symbols which are displayed -- you do not have to look at the letters painted on the keyboard and the computer doesn't know what's painted there anyway. Let's look at three (and a half) ways of putting these letters into your document.

KCharSelect: the application 'kcharselect' helps you pick characters from the entire range of Unicode characters -- if there's a letter for something, then kcharselect can help you find it. On my KUbuntu 9.04 installation it is not installed by default, so I used the package manager to add it first (I used sudo apt-get install kcharselect but the graphical manager can do it as well). If you like GNOME apps, it looks like 'gucharmap' is the one you want.

Once kcharselect is started it presents you with a page full of characters. You can click on any character to obtain information about it, or double click on it to add it to the little text box at the bottom of the window.

At the top of the window there is a search bar; type part of a description or character name and the displayed characters will be filtered. For instance, I typed in "Nigeria" and that slims the display down to the letters I'm interested in (no capital ƙ though?) as well as a Naira sign. Good!

After double-clicking the characters I am interested in into the text bar below, the "to clipboard" button puts them on the clipboard so I can paste them into the document I'm writing. Bit of a round-about way to do it and not fast when typing long documents, but it works.

Using xmodmap: Each key on the keyboard has a number. To find out which number, start the "xev" program from a terminal window (in KDE, start konsole; in GNOME, start gnome-terminal; then type xev). A small window with a box will appear. Move the mouse over the window. Notice that lots of output appears in the terminal from which you started xev.

Next, hit a key on your keyboard. You will see more output, which looks something like this:


KeyPress event, serial 30, synthetic NO, window 0x1600001,
root 0x13c, subw 0x1600002, time 21276913, (48,63), root:(53,895),
state 0x0, keycode 51 (keysym 0x1000259, schwa), same_screen YES,

The important number is the keycode (51 in this example). That is the number of the key you just pressed.

It is convenient to find four different keys on your system, one for ə, one for ƙ, one for ɓ and one for ɗ. On my keyboard, I used the keys [, ], \ and \ (I have two \ keys) which have keycodes 34, 35, 51 and 94.

The next step is knowing what the keyboard symbols are that you want for each key. The ə is called schwa, but the other Hausa letters don't have a name in the standard X keysym table. I looked them up with kcharselect so I could use their Unicode names, and found the following:


Khook Ƙ 0198
khook ƙ 0199
Bhook Ɓ 0181
bhook ɓ 0253
Dhook Ɗ 018A
dhook ɗ 0257

The final step is to assign these keyboard symbols to the key codes, so that when you press the key the right symbol appears. I'm going to put ƙ on my [ key (key code 34, key symbols U0199 and U0198). To do this, use xmodmap. This utility can be used to remap your keyboard, and can also hopelessly mess the keyboard up until you logout -- so be a little careful.


xmodmap -e "keycode 34 = U0199 U0198"

This maps keycode 34 to U0199 (ƙ) when pressed normally and to U0198 (Ƙ) when pressed together with shift -- just like normal lowercase- and uppercase letters. The next three commands assign the other keys:


xmodmap -e "keycode 35 = U0253 U0181"
xmodmap -e "keycode 51 = U0257 U018A"
xmodmap -e "keycode 94 = schwa SCHWA"

After these four commands, when I run my finger across the top row of letters on my keyboard, it produces qwertyuiopƙɓɗ; the ə is a strange key sandwiched between enter and the arrow keys. But the result is that I can type Hausa and Kanuri in a sensible way.

xmodmap revisited: instead of picking separate keys for each Hausa letter, you could add them to the existing keys for b, k, d and e. For that, we'll need to make sure there is a Mode_switch key set. I used the AltGr key on my keyboard, and found out that it had keycode 108. So I set it to be the mode switcher with


xmodmap -e "keycode 108 = Mode_switch"

Then I set up the b key (for instance) with the symbols for b, B, ɓ and Ɓ. These will appear when the key is pressed normally, when it is pressed with shift, pressed with AltGr and when pressed with shift and AltGr.


xmodmap -e "keysym b = b B U0253 U0181"

Using keyboard layouts: I have tried the Nigerian keyboard layout, Hausa variant, but there I couldn't find the ƙ at all, so I think that layout is broken in some way. I selected it from KDE's systemsettings / Language & Region module under keyboard, but it's no success. I can type lots of strange characters, but not the ones I need in Hausa.