GNOME Bugzilla – Bug 688149
allow clients to request arbitary keyboard layout
Last modified: 2021-05-25 17:46:25 UTC
Currently libcaribou's layout switching mechanism relies on the system settings, which is good enough for European languages. However, in some cases (CJK for example) clients may want different layout than system. This series of patches add a D-Bus method that allows clients to explicitly specify the layout. The first patch rewrites caribou-daemon in Vala. This is necessary because gdk_window_add_filter (which is needed to handle libxklavier event) is not easily accessible from Python (bug 688040). The second patch moves libxklavier event handling from libcaribou to caribou-daemon. When the system layout changes, caribou-daemon calls the D-Bus method to request the layout.
Created attachment 228765 [details] [review] daemon: port to Vala
Created attachment 228766 [details] [review] Move keyboard layout tracking from libcaribou to caribou-daemon Add a D-Bus method SetGroup to KeyboardService, which allows clients to explicitly request arbitrary keyboard layout. caribou-daemon detects keyboard layout changes by itself using libxklavier and call SetGroup.
(In reply to comment #1) > Created an attachment (id=228765) [details] [review] > daemon: port to Vala I think this deserves a bug of its own, and this bug should depend on it.
(In reply to comment #2) > Created an attachment (id=228766) [details] [review] > Move keyboard layout tracking from libcaribou to caribou-daemon > > Add a D-Bus method SetGroup to KeyboardService, which allows > clients to explicitly request arbitrary keyboard layout. > caribou-daemon detects keyboard layout changes by itself using > libxklavier and call SetGroup. Looks good. Maybe there should b a special argument to set_group, or another method that puts the keyboard back in "auto" mode where it respects the system setting. Also, maybe there is a way to interrogate the current IM as to what language is being used, and automatically switch Caribou. On second thought, would there even be an active IM in the case when there is no hardware keyboard?
(In reply to comment #3) > (In reply to comment #1) > > Created an attachment (id=228765) [details] [review] [details] [review] > > daemon: port to Vala > > I think this deserves a bug of its own, and this bug should depend on it. Sure. Filed as bug 688218.
Created attachment 228852 [details] [review] Move keyboard layout tracking from libcaribou to caribou-daemon Rebased against bug 688218. Not addressed comment 4 yet.
(In reply to comment #4) > Looks good. Maybe there should b a special argument to set_group, or > another method that puts the keyboard back in "auto" mode where it > respects the system setting. Well, perhaps icbw, I can't imagine a use-case of the "auto" mode in libcaribou. With this patch, caribou-daemon will watch the system setting and applies it to antler or gnome-shell OSK through set_group call. So, isn't it sufficient to keep caribou-daemon running? Yes, it watches AT-SPI events too. So one idea is to add an option to caribou-daemon to watch only keyboard settings. > Also, maybe there is a way to interrogate the current IM as to what > language is being used, and automatically switch Caribou. On second > thought, would there even be an active IM in the case when there is > no hardware keyboard? Afaik, there is no easy way to get the language through the active IM from caribou-daemon or libcaribou, since modern IM are implemented as framework which may host several language engines. But nowadays, gnome-settings-daemon handles all the XKB/IM swiches[1]. I'm currently thinking of adding a set_group call in gnome-settings-daemon itself. Footnotes: [1] https://live.gnome.org/ThreePointFive/Features/IBus
Although bug 688218 has landed, I think it would be safer to postpone this after 3.8. Instead, I'll try to handle X-config-change event in libcaribou, so it can work with GNOME 3.6 XKB handling. Will file a patch soon.
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new enhancement request ticket at https://gitlab.gnome.org/GNOME/caribou/-/issues/ Thank you for your understanding and your help.