How to switch hardware keyboard language?
Ed Bartosh
bartosh at gmail.com
Sun Dec 27 21:39:34 EET 2009
Hi,
Does anybody know how to get current hw keyboard language and how to
switch between them programmatically?
Here is what I did so far:
1. I could get list of configured layouts by reading gconf variables
/apps/osso/inputmethod/int_kb_layout and
/apps/osso/inputmethod/ext_kb_layout
2. setxkbmap -layout <layout> allowed me to switch keyboard layout to
<layout>. However, it worked quite funny way.
For example if I have English and Russian (us and ru layouts)
configured and English layout active(I can type English) after running
setxkbmap -layout ru sometimes I can type Russian, sometimes I can't!
But if I have Russian layout active and run setxkbmap -layout us it
always switches layout to English, but I can't switch it back to
Russian by pressing Ctrl+Space (or Ctrl+Chr on N810).
3. My attempts to get any info using xkb calls XkbRF_GetNamesProp,
XkbGetState didn't help much. Both calls return the same info
regardless of which layout is active.
4. I was able to switch layouts using XkbRF_SetNamesProp, but it
worked pretty much like setxkbmap.
5. It's also possible to switch layout by setting gconf variable
/apps/osso/inputmethod/int_kb_layout, but if I set it to 'us' it also
stops switching by Ctrl-Space even if I set
/apps/osso/inputmethod/ext_kb_layout to 'ru'
After doing above exercises I came to conclusion that I'm going wrong
way and setting xkb map isn't a proper way to switch languages on
Maemo. After reading sources of several desktop language switchers. I
also understood that xkb extension works differently on Maemo. Bugs
2501 and 3407 from Maemo bugzilla made me think that something might
be even broken in xkb internals. I gave up when I read this in the bug
2501: "The Ctrl+Space on languages other than Russian changes the
input language, not the keyboard layout". At that point I was totally
confused and decided to write this email.
Can anybody help me with this?
--
BR,
Ed
More information about the maemo-developers
mailing list