1

This question already has an answer here:

This is actually a coding question.

I know that the X server checks the active keyboard layout to figure out which character (supporting unicode) to emit. But I don't actually know how this is done, could someone point me to the source code where I can see this in action?

What I want to actually do is to create a "unicode keyboard driver" which can do the same thing (ignoring the active layout), but then I need to know how X is emitting the unicode character to the GUI.

Even if I need to add new functionality to the X server and recompile it that's okay. I just want to be pointed to the right source code for emitting those characters into the GUI.

EDIT:

The comments pushed me in good directions on where to find answers. I think I've now figured out how I can programmatically output unicode text into GUI's on Linux.

Hints: xdotool / libxdo, XTestFakeKeyEvent, xmodmap -e "keycode 107 = U2196"

I will see if I can eventually answer this question with my own C++ library to do this.

marked as duplicate by Isaac, Shadur, Rui F Ribeiro, G-Man, Kusalananda Feb 11 '18 at 8:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

I figured out the two commands needed to do this programmatically:

XChangeKeyboardMapping (to map an unused keycode to char/unicode)

XTestFakeKeyEvent (to send it to the X server)

Hence any char can be sent and the keyboard layout can stay the same.

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