XKB Limitations

From LSDevLinux
Jump to: navigation, search

It is quite possible that these are not limitations of the software but limitations in my understanding. I'd love to be proven wrong.

If these limitations seem too great for you, or you're not feeling particularly creative to overcome challenges, KMFL may be the best option for you, and will read your Keyman source file directly.

Fieldworks/WeSay XKB Compatibility Workaround

I've recently discovered that Keyboard switching in Fieldworks, WeSay and maybe other SIL applications, do not query XKB for its list of keyboards. I discussed this with their support team, finding that they had run into problems getting this to work, and had temporarily settled on only supporting ibus. Therefore, only keyboards that show up in ibus can be chosen.

This means that while you can type with xkb in Fieldworks, it will not autoselect the keyboards with the current configuration. This is a shame, as IBus has much more limited application support than XKB, but the Fieldworks team is working on it. In the meantime, I have found a workaround to "import" xkb keyboards into the ibus interface. Ibus supports a number of engines, the default is "m17n" which gives the base list of keyboards. Another familiar engine is KMFL. In this tutorial, we will be adding ibus-xkb-layouts into ibus.

The package ibus-xkb-layouts is a useful update I found that was created for Fedora 14, but is usable if built for Ubuntu and moved to the right places. (One can reconfigure the package file to make it Ubuntu-compatible directly as built...but copying 2 files is much easier.) Instructions written under Natty, but should work under Maverick/Oneiric.

This workaround requires IBus 1.3, which seems to exclude Lucid (10.04) or earlier users. Lucid uses ibus 1.2, and both the build and manual installation seem to fail because of dependancies. If libibus 1.3 is ever back-ported to lucid, then this process could work there.

  1. If you're on Ubuntu 10.10 or 11.04, ibus and python-ibus and ibus-m17n should already be installed.
  2. Add "export GTK_IM_MODULE=ibus" to the bottom of the file ~/.profile (instead of xim).
    • If you're scared of building from source, you can try downloading the copies I built, but I can't guarantee they'll work for your version. (These were built under UbuntuStudio 11.04 x86 and the xml file was modified to point to the new spot.)
    1. Open a command window and type "sudo nautilus".
    2. Put xkb-layouts.xml here: /usr/share/ibus/component/xkb-layouts.xml
    3. Put ibus-engine-xkb-layouts here: /usr/lib/ibus-xkb-layouts/ibus-engine-xkb-layouts
    4. Right click on the engine file, choose properties, and verify on the permissions tab that it is executable.
    5. Restart ibus or logoff/logon and restart ibus.
    • Instead, if you're comfortable building from source, this is the better way:
    1. Install libibus-dev and libxkbfile-dev. These sources may be needed to build the files.
    2. Download the code for the plugin from ibus-xkb-layouts to a temporary folder. You can download just the source, or the generated package (i.e. ibus-xkb-layouts-0.0.0.tar.gz).
    3. Extract your the archive to a temporary folder.
    4. Open a terminal window and browse to that folder.
      • If you have downloaded only the source (i.e. fujiwarat-ibus-xkb-layouts-1b319d1.tar.gz), you must run ./autogen.sh first.
      • If you downloaded the complete Package (i.e. ibus-xkb-layouts-0.0.0.tar.gz), you don't need to run ./autogen.sh, but I don't think it'll hurt.
    5. This package was pre-built for Fedora, so we need to run a command to point the files in the right direction. Run ./configure --datadir /usr/share --libexecdir /usr/lib/ibus-xkb-layouts
    6. Run make
    7. Run sudo make install
    8. Restart ibus or logoff/logon and restart ibus.
  3. Now you get to do the ibus configuration dance and add your new keyboards. Open System > Preferences > Keyboard Input Methods. From the Input Method tab, choose "Select an input method". If all went well and we've followed all the steps, you should see all the languages from XKB listed alongside the m17n ones. Choose your language from the input methods list (they are sorted by language instead of country), then click Add. Add any other keyboards that you will need in FLEx.
  4. You'll probably want to install "ibus-kmfl" and "kmfl-keyboard-ipa" from the SIL repository, as this keyboard is too complex for XKB.
  5. With Ibus loaded, start FLEx.
  6. Now, you should find all keyboards you just added to ibus listed in FLEx under Tools>Configure>Set up Writing Systems>*yourlanguage*>Keyboard. Choosing "None" deactivates ibus and passes off control to whatever XKB you have currently selected.

Combining Characters

While keyboards are defined in XKB, composed characters are defined by and hard-coded into gnome. It seems that all languages use a common compose file, and I doubt we are allowed to greatly customize it. If you add a special key called dead_hook, you could use it to create a hooked b or d, but would have no control over which character you were given when combined with eng, and the given eng does not match the African eng. For yourself, you can override this with a custom XCompose file in your home folder, but I do not know how we would get this into the repository.

Secondly, I think that all "composed" characters are fully composed if possible. While this is ideal for French, often decomposed characters are used for minority languages. To get around this limitation, one can use the tricks in "AltGr and "Special" Shift Key" and not use the selection of dead keys.

See the discussion on what is possible, see Dead keys and diacritics

Custom Combinations Greater than Two Characters

Again, combinations are defined by Gnome, and are relatively static. I know no good way to type a string of characters and later convert them into a custom string. There is a "Compose" function, by which you hold the Windows(Multi) key. You can get a list of these combinations from the dumbfoundingly static /usr/share/X11/locale/en_US.UTF-8/Compose. Oddly enough, this file, though very complete, is not actually used by default, because a copy of it is hidden somewhere in Gnome.

You can, however, on you computer create a file called .XCompose in your home folder to make up your own commands (and add xim to your imput methods), but this isn't something you could easily add to the repository, as it is per-user.

Order Changes

Though it was possible in Keyman, I do not think it is possible to type a diacritic before the letter, yet receive a decomposed combination. You are stuck with dead keys as discussed above, or the standard letter-diacritic combinations handled by Unicode.