Summary:
http://who-t.net/ibus.txt
http://live.gnome.org/GnomeShell/Design/Guidelines/SystemStatus/InputLanguage
**** Fri Dec 3 12:25:04 2010
12 03 12:26:34 <whot> so, ibus now transparently wraps xkb layouts, right?
12 03 12:26:42 <whot> at least that's how it looks like (though I couldn't get it to work yet)
12 03 12:27:37 <fujiwarat> Yes, the original request was users want to choose layouts and input-methods in ibus.
12 03 12:28:08 <fujiwarat> Especially in European keyboards.
12 03 12:29:11 <whot> do you have any plans for integrating it with gnome?
12 03 12:30:35 <fujiwarat> It sounds great.
12 03 12:32:32 <fujiwarat> I didn't think to update gnome modules but probably I think it's also great.
12 03 12:33:14 <whot> help me with a few general questions I have to understand how it works. i'm trying it out here but it doesn't seem to do what I want
12 03 12:33:38 <whot> right now, in gnome we select a few keyboard layouts. if ibus is started too, ibus manages the layouts as well
12 03 12:33:51 <whot> so the few questions I have to get an overview of it:
12 03 12:34:07 <whot> - ibus doesn't yet hook into the gnome kbd selection, but it will at some point, right?
12 03 12:34:25 <whot> - ibus changes the keyboard layouts directly, it doesn't wrap them or so
12 03 12:35:09 <whot> - does ibus still need to be enabled for each window to work like this or is it transparent for non-IM languages?
12 03 12:35:31 <whot> i think that's it for now. let me know if something is planned, even if it doesn't work just yet
12 03 12:35:32 <fujiwarat> If you see [Advanced] tab in ibus-setup, the keyboard is default. It means to get the layout from gnome-settings-daemon.
12 03 12:36:19 <fujiwarat> /usr/lib/python2.7/site-packages/ibus/xkblayout.py just runs /usr/libexec/ibus-xkb .
12 03 12:36:29 <whot> so what happens if I have more than one keyboard in gnome?
12 03 12:36:36 <fujiwarat> /usr/libexec/ibus-xkb --get
12 03 12:36:36 <fujiwarat> layout: us
12 03 12:36:36 <fujiwarat> model:
12 03 12:36:36 <fujiwarat> option:
12 03 12:37:05 <fujiwarat> ibus get the outputs for the default layout.
12 03 12:37:58 <fujiwarat> If you add more layouts, it would be 'layout: us,jp,ru'
12 03 12:39:56 <fujiwarat> If the layout is not default, ibus saves the customize layouts and run ibus-xkb --layout foo --option foo ...
12 03 12:41:22 <whot> so it loads it into the server, but doesn't yet change the gnome setting, right?
12 03 12:43:12 <fujiwarat> Yes, currently it doesn't update gconf value /desktop/gnome/peripherals/keyboard/kbd .
12 03 12:45:04 <fujiwarat> The current ibus has the gconf value /desktop/ibus/general system_keyboard_layout & system_keyboard_option .
12 03 12:46:55 <whot> have you seen http://live.gnome.org/GnomeShell/Design/Guidelines/SystemStatus/InputLanguage yet?
12 03 12:47:08 <whot> sorry, I'm coming late to the discussion, not sure how much of that you already know
12 03 12:48:57 <whot> ibus-xkb gets the data from the server I guess, not from gconf?
12 03 12:49:29 <fujiwarat> Yes, I know that page. However I think we don't proceed the discussion recently.
12 03 12:49:55 <whot> fair enough. I just got an email from Owen yesterday about my thoughts on the whole thing, so I'm trying to get the background info
12 03 12:50:06 <fujiwarat> Yes, ibus-xkb doesn't check the gconf value directly.
12 03 12:50:24 <whot> if I select e.g. pinjin in ibus, what keybaord layout is applied then?
12 03 12:51:18 <fujiwarat> If the ibus layout is default, the pinyin layout will be used the value of 'ibus-xkb --get'.
12 03 12:52:00 <whot> hmm
12 03 12:52:04 <fujiwarat> It means the layout is set by GDM and gnome-settings-daemon initially.
12 03 12:52:12 <whot> does ibus use keysyms yet or still keycodes?
12 03 12:56:29 <fujiwarat> I think the keycode and keysyms are get by gdk(x11).
12 03 12:56:33 <fujiwarat> /usr/lib64/gtk-3.0/3.0.0/immodules/im-ibus.so
12 03 12:57:09 <fujiwarat> https://github.com/fujiwarat/ibus/blob/master/client/gtk2/ibusimcontext.c#L464
12 03 12:58:10 <whot> hmm, still using the keycodes then
12 03 12:58:21 <fujiwarat> ibus_im_context_filter_keypress() is inherit from GtkIMContext.
12 03 12:58:48 <fujiwarat> Yes, Ctrl+Space switch input-methods.
12 03 13:00:49 <fujiwarat> From the image http://live.gnome.org/GnomeShell/Design/Guidelines/SystemStatus/InputLanguage?action=AttachFile&do=get&target=language-menu.png :
12 03 13:00:56 <whot> what do you think about using keysyms in ibus?
12 03 13:02:08 <fujiwarat> ibus provides the Russian and English layouts and also the 'Chinese (Pinyin)' layout can be customized.
12 03 13:02:37 <whot> so if I switch to Pinyin in this case, what would the xkb layout be?
12 03 13:04:08 <fujiwarat> The pinyin's layout is the session layout which was got by 'ibus-xkb --get' initially.
12 03 13:05:15 <whot> right. I think it would be good if ibus switched to the xkb layout that you expect on the keyboard
12 03 13:05:30 <whot> afaict, this is "us", since that's the closest one to the keycode layout
12 03 13:05:57 <fujiwarat> > what do you think about using keysyms in ibus?
12 03 13:06:21 <whot> so in the picture listed above, XKB should have "en,us,ru,us", because both ja and Pinyin use ibus and ibus needs the qwerty layout
12 03 13:06:49 <fujiwarat> I may not understand your question, If pinyin receives ASCII 'a' for example, pinyin returns the chinese 'a' so ibus needs to get the keycode/keysyms.
12 03 13:07:14 <whot> heh. it's a bit more complicated than that :)
12 03 13:07:31 <whot> the keycodes we get from the keyboard are more-or-less random numbers
12 03 13:07:43 <whot> they aren't random, but they don't carry any information in X
12 03 13:08:11 <fujiwarat> Yes, in the picture list, if users choose 'en', ibus runs ibus-xkb --layout us
12 03 13:08:31 <whot> e.g. the "a" key on a qwerty layout has keycode 61. on a french azerty layout, the "a" key has keycode 24
12 03 13:08:39 <fujiwarat> If users choose 'ru', ibus runs ibus-xkb --layout 'us,ru'.
12 03 13:09:34 <fujiwarat> If users choose 'Chinese', ibus runs ibus-xkb --layout $SESSION_LAYOUT --model $SESSION_MODEL --option $SESSION_OPTION
12 03 13:09:53 <whot> one more question before I continue explaining: ibus_input_context_process_key_event() gets both keyval and hardware_keycode. which one does ibus use?
12 03 13:13:48 <fujiwarat> Actually it depends on each engine. E.g.
12 03 13:13:53 <fujiwarat> https://github.com/fujiwarat/ibus-anthy/blob/master/engine/engine.py
12 03 13:14:01 <fujiwarat> ibus-anthy checks keyval.
12 03 13:15:18 <fujiwarat> If you choose 'ru', ibus runs ibus-xkb and the engine doesn't touch any key events.
12 03 13:16:41 <whot> ok, so what if I have a system keyboard config of "af" and then try to run ibus-anthy on top. the keyval of those will have little meaning, right?
12 03 13:18:07 <fujiwarat> Yes, I think you mean 'af' doesn't have ASCII and it won't work with ibus-anthy :).
12 03 13:18:36 <whot> ok. that's what I meant with "ibus should switch the xkb layout" when it needs to
12 03 13:19:44 <fujiwarat> Yeah, the system layout will be 'jp' or 'us' in most Japanese users.
12 03 13:21:41 <whot> but that's just because most ppl who use anthy don't use "af" as well
12 03 13:23:45 <fujiwarat> Yeah, I think it would be request base.
12 03 13:23:58 <whot> huh? sorry, I didn't understand that bit
12 03 13:25:16 <fujiwarat> I mean if some people want to use ibus-anthy with 'af', we'll implement it in the engine side.
12 03 13:25:42 <whot> why don't you just switch to "us" when ppl try to use anthy?
12 03 13:28:57 <fujiwarat> Probably I think I don't have the list which should revert to 'us'.
12 03 13:30:33 <fujiwarat> In your case, I think it can work if ibus shows 'af and Japanese (anthy)' and the system layout is 'us'.
12 03 13:30:59 <whot> ok, so here's how I would like it to see, provided that ibus and gnome are well integrated:
12 03 13:31:22 <whot> system layout is "af" and that's stored in gconf...
12 03 13:31:43 <fujiwarat> If you choose [Input Method] tab in ibus-setup, it can add the layouts and input-methods.
12 03 13:32:02 <whot> user logs in, selects "Jp (anthy)" _in addition_. ibus needs "us" for anthy, so it stores "af,us" in the gconf key...
12 03 13:32:11 <whot> so now you have both as system layouts...
12 03 13:32:27 <whot> and whenever the user toggles to "us" with a shortcut or whatever, ibus kicks in and does the anthy translations
12 03 13:32:40 <whot> for "af" it can just stay transparent
12 03 13:33:46 <fujiwarat> Yes, actually I implement to add 'us', if ibus-xkb --get returns the non-latin layouts.
12 03 13:34:12 <fujiwarat> https://github.com/fujiwarat/ibus/blob/master/data/ibus.schemas.in#L207
12 03 13:34:35 <fujiwarat> >[ara,bg,cz,dev,gr,gur,in,jp(kana),mal,mkd,ru,ua]
12 03 13:35:06 <fujiwarat> oops chat command..
12 03 13:35:09 <whot> so if only these are in the list, you add "us"? do I understand this correctly?
12 03 13:35:25 <fujiwarat> Yes
12 03 13:35:29 <whot> neat
12 03 13:35:37 <whot> that's what I wanted :)
12 03 13:35:51 <whot> now, if you can write that back into the gconf settings, then we're half-done
12 03 13:38:17 <fujiwarat> Do you mean ibus modify the GNOME setting /desktop/gnome/peripherals/keyboard/kbd ?
12 03 13:38:32 <whot> yeah, get and read info from there
12 03 13:39:40 <fujiwarat> OK, I see.
12 03 13:39:46 <whot> is there a limit on how many layouts ibus supports?
12 03 13:39:50 <whot> simultaneously, I mean
12 03 13:40:20 <fujiwarat> ibus just parses /usr/share/X11/xkb/rules/evdev.xml
12 03 13:40:44 <whot> no, I mean how many layouts can I configure simultaneously?
12 03 13:41:02 <whot> the screenshot above had 4 (en, jp, ru and pinyin)
12 03 13:41:11 <whot> is there a limit? XKB has a limit of 4
12 03 13:42:45 <fujiwarat> Ah, one layout can include the 4 layouts and ibus has no limitation to switch layouts(engines).
12 03 13:43:15 <whot> well, here's a big selling point for ibus: there's no reason it couldn't support > 4 layouts
12 03 13:45:36 <fujiwarat> Yeah, in that picture, it could be 'en', 'jp,us,ru,fr', ru, 'jp,us,zh', 'fr, 'ge'
12 03 13:46:09 <fujiwarat> s/en/us/
12 03 13:46:30 <whot> can it be "en,jp,us,ru,fr,pinyin,anthy,ge,cz,es"? that's the point I'm getting at
12 03 13:46:43 <whot> with pinyin and anthy managed by IM, the rest normal XKB layouts
12 03 13:46:59 <fujiwarat> Yes ibus-setup can do it.
12 03 13:47:17 <whot> cool, so it already rotates through the layouts then?
12 03 13:48:11 <fujiwarat> Yes, ibus provides the short-cut key to switch engines and ibus configures the layout as one engine.
12 03 13:48:40 <whot> i'm not sure I understood the second part of this sentence
12 03 13:48:55 <whot> in the above example, what would be the XKB setting?
12 03 13:50:42 <fujiwarat> engine means anthy, pinyin and others and I create new engine for the xkb layouts.
12 03 13:51:38 <fujiwarat> If I express engine as '[]', your example will be "[en],[jp],[us],...,pinyin,anthy,..."
12 03 13:51:56 <fujiwarat> and ibus can switch engines with a shortcut key.
12 03 13:52:18 <whot> what do you mean by "engine"?
12 03 13:54:02 <fujiwarat> Ah, I mean engine is the input-method engine and ibus is the input-method frame work.
12 03 13:55:54 <fujiwarat> And the the engine for XKB layout is used to set the layout only by ibus-xkb.
12 03 13:59:59 <whot> ok, so XKB itself only supports up to 4 layouts. you can't load more than one into the server. where would this be handled then?
12 03 14:05:34 <whot> can you check this for correctness please?
12 03 14:05:36 <whot> http://pastebin.com/raw.php?i=Xe3sPCyL
12 03 14:05:46 <whot> is this an accurate summary? I'm planning to send this to the gnome guys
12 03 14:05:52 <fujiwarat> Yes, the system layout can be configure by 4 layouts. anthy can set by 4 layouts[jp,ru,fr,de]
12 03 14:06:42 <fujiwarat> In your example, [us], [jp], [fr], [ru,us], [jp,ru,fr,de]
12 03 14:06:51 <fujiwarat> It can configure more than 4 layouts.
12 03 14:08:15 <fujiwarat> I opend http://pastebin.com/raw.php?i=Xe3sPCyL but it's null content.
12 03 14:13:57 <whot> oh, weird. must have been deleted in the minute between... one second
12 03 14:15:13 <whot> http://who-t.net/ibus.txt
12 03 14:20:30 <fujiwarat> > so those that have option
12 03 14:20:30 <fujiwarat> grp:alt_toggle should have the same group switch for ibus
12 03 14:20:55 <fujiwarat> Hmm.., currently I don't think to same short cut key.
12 03 14:21:34 <fujiwarat> [us], [jp], [fr], [ru,us], [jp,ru,fr,de] are switch by ibus short cut key.
12 03 14:21:54 <fujiwarat> The ru,us are switch by XKB option key.
12 03 14:21:56 <whot> this is just a point where merging ibus and gnome together (from a UI Perspective, not the code) will be an issue
12 03 14:22:13 <whot> the keys to switch between input languages, be they xkb or IM should be the same across all
12 03 14:23:14 <fujiwarat> However they are two layer switching; one is between groups and another is within groups.
12 03 14:24:12 <fujiwarat> XKB option is used for within a group.
12 03 14:25:05 <whot> from a user perspective - why?
12 03 14:25:25 <whot> i know the technical reasons, but why from a UI perspective. that's what the new GNOME stuff is supposed to address
12 03 14:27:24 <fujiwarat> because the system layout is used for the specific input-methods; pinyin, anthy. They has within-group switching with XKB option and also we need to switch anthy and us which is between-group switching.
12 03 14:28:10 <fujiwarat> s/They has/They have/
12 03 14:32:10 <whot> that's the technical reason, isn't it? :)
12 03 14:32:34 <fujiwarat> Hmm.., I see your point.
12 03 14:37:02 <fujiwarat> Probably it might be a bit complicated. If ibus and XKB has the same short-cut key, we may need a logic to get the key event by ibus only
12 03 14:39:24 <fujiwarat> > http://who-t.net/ibus.txt
12 03 14:39:28 <fujiwarat> OK with me.
12 03 14:41:39 <whot> cool, thanks
12 03 14:42:00 <whot> as for the logic: you get events from XKB when the group changes. so you can hook onto that and then adjust ibus internally to the next layout
12 03 14:44:25 <fujiwarat> OK, I see. I'll think the better implementation.
12 03 14:45:19 <fujiwarat> We also need to think how to show the GUI on the panel status area.
12 03 14:47:12 <fujiwarat> We just show ibus panel or migrate ibus APIs to gnome-settings-daemon.
12 03 14:48:14 <whot> yes, that was Owen's hope
12 03 14:48:25 <whot> to add a ibus panel to the control-center
12 03 14:48:31 <whot> any idea on how long that would take you?
12 03 14:59:10 <fujiwarat> How about creating a wrapper application which invoke an application from a gconf value, e.g. /desktop/gnome/input-method/status .
12 03 14:59:16 <fujiwarat> ?
12 03 15:00:13 <fujiwarat> Currently the ibus panel is /usr/libexec/ibus-ui-gtk
12 03 15:09:01 <fujiwarat> I think it would depend on what the control-panel application do. I think it's easy if it's just a wrapper.
12 03 15:11:18 <whot> I can't really comment on writing gnome apps, don't have the experience
12 03 15:13:30 <fujiwarat> OK, I see. I'm not sure what kind of implementation destktop team expects. But I'll try a prototype in this month.
12 03 15:14:05 <whot> best to ping mccann and otaylor
12 03 15:14:16 <whot> they'd be able to tell you more
12 03 15:14:33 <fujiwarat> OK, I see. thx.
12 03 15:14:55 <fujiwarat> Do you know their timezones?
12 03 15:15:04 <whot> boston
12 03 15:15:11 <fujiwarat> OK, I see.
12 03 15:15:14 <whot> not optimal for either of us :)
12 03 15:15:42 <fujiwarat> :)