xkb – Custom Layout for One Key Creating Two Unicode Code Points

keyboardx11xkbxorg

I am writing a new custom keyboard layout for Xorg, but there is one particular glyph which does not exist in Unicode. It is, however, easy to create it by using a standard letter plus a combining diacritic mark.

For example, if I want the letter v with a macron below, the sequence U0073+U0331 creates the character that I want.

In my xkb layout definition, I can specify a single Unicode point (here altgr+d is bound to ḏ and altgr+shift+d to Ḏ):

key <AC03>  { [         d,          D,        U1E0F,        U1E0E ] }; // d with macron below

But I don't seem to be able to specify a 'combined' Unicode glyph for a single key:

key <AB04>  { [         v,          V,  U0076+U0331,  U0056+U0331 ] }; // v with macron below

Is it possible to create a system-wide xkb definition like this?

Best Answer

EDIT:

Still trying...

Testing shows that the keymap will ONLY take a single key in each position.

BUT, if you use a rare/never used keysym in the keymap definition, then a global Xmodmap to make THAT keysym output the various unicode characters you need, this'll work.

In the keymap:

key <AB04>  { [ v, V, XF86LaunchA, XF86LaunchB ] };

In a global Xmodmap: (perhaps loaded from /etc/profile.d ?)

keysym XF86LaunchA = U0056 U0331
keysym XF86LaunchB = U0076 U0331

There are quite a few unused/special-use keysyms, I chose the LaunchA/B as an example.

Related Question