diff options
Diffstat (limited to 'README')
-rw-r--r-- | README | 48 |
1 files changed, 48 insertions, 0 deletions
@@ -0,0 +1,48 @@ +[xkb-boshiamy] +Hack to implement Boshiamy Input Method using only X11 config files +------------------------------------=[Setup]=----------------------------------- +Move +--------------------------------=[How it Works]=-------------------------------- +X11 handles key inputs via the xkb extension, which in addition to defining +keymaps/layouts, also handles compose/dead keys on the +application side via libxkbcommon. I have hijacked this functionality to +implement a fully functional version of the Boshiamy input method that requires +no software other than X11, and which should be in theory compatible with any +X11 application unlike ibus or fcitx. + +Background]=--- +What is a compose/dead key? + Certain keyboard layouts allow for diacritics to be added to letters via + "dead key". For the user this means pressing the diacritic key followed + by the base letter. For example, to type "ô" on the German layout you + would press the "^" key followed by "o". The "^" is called a "dead key". + For those curious, you type "^" by itself by pressing the key twice. + + Compose is a similar functionality except is relies on pressing a + predefined "compose" key followed by a sequence of other keys. For + example AltGr+e+= types the euro sign "€". + + In X11's case, this is all defined via a config file in + /usr/share/X11/locale/$LOCALE/Compose. For reference, the Compose file + for en_US.UTF-8 is 5000 lines long, which is on the order of magnitude + of your average Chinese input method. + + This functionality can also be user defined at ~/.XCompose + +How exactly is this functionality being handled by X11? + + When a key is pressed, X11 sends a key event containing "key symbols" to + the application. This includes printable ascii characters like "a" or + "@" but it can also be keys like "prsc" (printscreen) or non ascii + characters like "Г" or "肏". The specifics of how physical keys get + turned into key symbols are defined in /usr/lib/X11/xkb/. + + Compose happens at one layer of abstraction above "key symbols". Most + applications after receiving an X11 key event, use libxkbcommon to + translate this into a string, during which the Compose table is + referenced to get the desired result of the compose sequences. + +Boshiamy Implementation]=--- + +First, I did some regex wrangling to create a Compose file that defines every +character on my computer's copy of Boshiamy |