/Indic

A phonetic Indic input method

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Indic

A phonetic input method for Indic scripts.

Background

  • 99.9999% of all computer keyboards and laptops sold in India have the US layout. That number is an underestimation.
  • Devanagari and other keyboard layouts are available in GNU/Linux but mastering such a keyboard is beyond the capability of most users.
  • To write in Devanagari, or Bengali for that matter, users prefer to type phonetically.
  • Avro keyboard does exist, but it requires iBus under GNU/Linux.
  • iBus sucks. It was not designed for Indic scripts. And SCIM. And fcitx.

Indic keymappper is alpha software. It can blow up your computer, freeze your keyboard or mouse or even change the keyboard layout to Indic. You have been warned.

What is Indic

Indic is a Python script to the key codes generated by the Linux kernel using python-evdev and maps a phonetic key sequence to the symbols defined /usr/share/X11/xkb/symbols/in. The X11 keyboard is loaded using the setxkbmap in command from within Python. The phonetic key sequences are defined in the files d.map (Devanagari) and b.map (Bengali). The kernel keycodes are in keycode.map and any additional key codes could be defined in there.

The program works system-wide -- that is, it will map keystrokes for all X11 applications. Obviously, X11 applications need to support complex glyph rendering required for Indic fonts.

Platforms

Indic keymapper works in GNU/Linux with X11. Wayland may or may not be supported (please let me know if you try it).

Indic doesn't use the mouse or touchpad devices. However, it needs to register mouse and touchpad clicks to adjust its state machines so that partial phonetic matches don't carry over when a different window is clicked (comes into focus).

Current Issues

  • Some keystrokes register more than once. Happens occasionally.
  • After exiting the program, one Return/Enter key doesn't get registered.

Requirements

  • tkinter - On Ubuntu or Debian, this can be installed from the package python3-tk.deb
  • evdev(https://github.com/gvalkov/python-evdev) - sudo pip3 install evdev
  • subprocess, threading, select - should be available in a standard 3.1x CPython installation
  • select - sudo pip3 install evdev

How to run

The command below will add the current user to the input group, this is needed only one time -- to let you access evdev:

$ sudo usermod -a -G input <your_username>

You might need to reboot your computer at this point.

Then run the Python source:

$ cd /git/clone/path/indic/

$ python3 ./indic.py

A widget to switch between Indic and US keyboard pops up. Bengali keymap is currently not available (under development). Press Shift+Escape to close the Indic keymapper.

Inputting Bengali

Bengali needs sepcial handling of reph and khaNDa ta.

bengali-pecu

Future Plans

  • Replace calls to system xmodmap using Python X11 bindings.

Phonetic Transliteration

Indic-translit

Indic in Action

indic

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.