Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

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.

share|improve this answer
    
Thanks for the answer. One drawback is that this would be a per-use setting, right? Doing it with xkb would make it system-wide and means it can be distributed in a single file. Of course, those conditions were in my original question! –  SigueSigueBen Jul 15 '12 at 0:34
1  
I dug through the source code, there doesn't seem to be any support for including multiple keystrokes in the key definitions of the keymap. Of course, you could rewrite it yourself to implement that ability! –  lornix Jul 15 '12 at 3:29
    
Not the answer I wanted but that's the answer nonetheless. I'll poke around the source code a bit myself and look at the options you've suggested. Thanks. –  SigueSigueBen Jul 15 '12 at 4:02

On the other hand, you can attach to a given key the unicode combining diactityics character itself, and then you can type it after any other character. Indeed that is the way the unicode combining characters are suposed to work.

In X11 there are dead keys, dead keys work the other way: first the dead key, then the base letter. There is a <dead_belowmacron>, you can attach it to some key.

Then you need to edit the Compose file for your locale (if someone knows how to append definitions to Compose file from a user defined location I would apreciate), and add lines like:

# when the output is a single unicode char, you put also the corresponding
# X11 symbol name
# <symbol> <symbol> : "one-char-string" <symbol>
<dead_belowmacron> <d> : "ḏ" U1E0F
<dead_tilde> <n> : "ñ" <ntilde>
# when the output is a multicharacter string, you put just the string
# <symbol> <symbol> : "string"
<dead_belowmacron> <v> : "v̱"

the Compose file to use is defined by locale in the /usr/share/X11/locale/compose.dir file (path may vary).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.