How do you add a new keysym to X11?

Viewed 406

I am looking to add custom keysyms to X11. So rather than taking something unused, such as XF86LaunchB, I want to add something like ML_Keyboard_GUEST. This would be clearer to me on the intent I had behind the keybind.

I realise there is another step to assign the keysym to a keycode with xmodmap -e, but this is not my question.

I found that the keysyms live in /usr/include/X11/, keysym.h, keysymdef.h, XF86keysym.h etc. I tried to make my own version and place it in the directory:

/* /usr/include/X11/MyCustomKeysyms.h
 *
 * Keysyms for my macro keypad
 *
/
/* VM Controls */
#define ML_Keyboard_GUEST   0x1009FE24   /* Swap the keyboard to the guest */
#define ML_Keyboard_HOST    0x1009FE25   /* Swap the keyboard to the host  */

I did a text search of the directory to make sure the range I wish to use (0x10090001 - 0x1009FFFF) is available. I found no results for the two values I wish to use, 0x1009FE24 and 0x1009FE25. So I figure I am safe there.

I restart my computer and attempt to use the keysym:

$ xmodmap -e 'keycode 190 = ML_Keyboard_GUEST'
xmodmap:  commandline:1:  bad keysym name 'ML_Keyboard_GUEST' in keysym list
xmodmap:  1 error encountered, aborting.

I imagine this is something to do with me not including my custom file somewhere, or simply that my file will not be picked up without "recompiling" X11.

So, what is the correct way to add a keysym?

Thanks.

0 Answers
Related