I’m using Xlib for a project, and I’m trying to get the KeySym relative to a pressed key.
I’ve got the KeyCode relative to the pressed key, keyboard modifiers and keyboard indicators. I’m referring to this page to understand how to retrieve the correct key, but it must be out of date or something, because my X doesn’t behave like that page says.
I’ve got some questions:
-
What is MODE SWITCH? How can I see what key is my MODE SWITCH and how can I set it? (via Xlib functions or via a command, it’s the same).
-
That page says that the first 4 KeySyms associated to a KeyCode (found with
XGetKeyboardMapping, or shown byxmodmap -pkcommand) are divided into two groups. MODE SWITCH switches between groups, and within a group the first or the second KeySym is chosen according to modifiers (ie, shift key) or indicators (ie, caps lock). But on my X I can see that if shift is pressed, I switch to the third KeySym, not the second one. -
On many european layouts AltGr key is bound to KeySym
XS_ISO_Level3_Shift, which doesn’t belong to any keyboard modifier (ie,shift,lock,control,mod1,mod2,mod3,mod4andmod5). When suchXS_ISO_Level3_Shiftis pressed, the fifth KeySym associated to the KeyCode is chosen. Why? Where can I found some info about thisXS_ISO_Level3_Shiftand about other keysyms that are actually used, but not documented on Xlib manuals?
It looks like the page you’re reading predates Xkb – I’d guess that content is 10-15 years old at least.
See: http://www.xfree86.org/current/XKBproto.pdf
“xmodmap -pm” will show you the modifier keys such as mode switch.
With Xkb, the behavior of basically everything is configurable, I believe. Start looking at /usr/share/X11/xkb/ for example. I don’t know a lot about it but hopefully looking at Xkb instead of old docs will get you pointed in the right direction.