Skip to content

Commit 3c0ad00

Browse files
authored
integration: add input method section
1 parent 18244f9 commit 3c0ad00

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

src/integration.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
7. [Session Lock](#session-lock)
1515
8. [Desktops](#desktops)
1616
9. [Qt](#qt)
17+
10. [Input Method](#input-method)
1718

1819
# 1. Introduction {#introduction}
1920

@@ -328,6 +329,83 @@ and set `QT_QPA_PLATFORMTHEME=qt6ct` in `~/.config/labwc/environment`.
328329

329330
[qt6-wayland]: https://archlinux.org/packages/extra/x86_64/qt6-wayland/
330331
[qt6ct]: https://github.com/trialuser02/qt6ct
332+
333+
# 10. Input Method {#input-method}
334+
335+
Input methods like Fcitx5 and IBus provide modules for GTK and Qt and an
336+
interface for xserver (xwayland) using D-Bus without wayland protocols.
337+
338+
You can enable input method for those platforms by setting environment
339+
variables like this:
340+
341+
```
342+
export GTK_IM_MODULE=fcitx
343+
export QT_IM_MODULE=fcitx
344+
export XMODIFIERS=@im=fcitx
345+
```
346+
347+
<!-- TODO: remove "in the master branch" when labwc 0.7.2 is released -->
348+
For apps not running on those platforms (e.g. Alacritty), labwc supports
349+
the following wayland protocols in the master branch:
350+
351+
- [text-input-v3]
352+
- Used by winit apps (e.g. Alacritty) and GTK (without setting
353+
`GTK_IM_MODULE` environment variable).
354+
- [input-method-v2]
355+
- Supported by Fcitx5, but not by IBus yet
356+
([issue](https://github.com/ibus/ibus/issues/2182)).
357+
358+
Here is a quick guide for using Fcitx5 in labwc:
359+
360+
1. Install fcitx5, GTK/Qt modules, configtool and language-specific module.
361+
- Arch Linux: `pacman -S fcitx5-im fcitx5-mozc`
362+
- Ubuntu: `apt install fcitx5 fcitx5-mozc`
363+
364+
Replace `fcitx5-mozc` with a module for your language.
365+
366+
2. Set `GTK_IM_MODULE`, `QT_IM_MODULE` and `XMODIFIERS` like described earlier.
367+
These are usually saved in files like `~/.config/labwc/environment`,
368+
`~/.profile` and `/etc/environment`.
369+
370+
3. Start `fcitx5`. You can automatically start fcitx5 by adding `fcitx5 &` to
371+
`~/.config/labwc/autostart`.
372+
373+
4. Configure Fcitx5 with configtool to enable the installed language-specific
374+
module and to set up hotkeys. See [Configtool (Fcitx 5) - Fcitx].
375+
376+
5. Activate input method with hotkeys while typing in applications.
377+
378+
<!--- TODO: remove this once Chromium supports text-input-v3 -->
379+
## Input method on Chromium
380+
381+
Chromium (and Electron-based) apps don't support the [text-input-v3] protocol
382+
[at this point](https://chromium-review.googlesource.com/c/chromium/src/+/3750452).
383+
So if you want to use IME with Chromium under labwc, you have following options:
384+
385+
1. Run Chromium under XWayland
386+
387+
This is the default option. However, some features like touchpad gesture
388+
don't work.
389+
390+
2. Use GTK IM Module
391+
392+
By running Chromium with `--enable-features=UseOzonePlatform --ozone-platform=wayland --gtk-version=4`,
393+
you can enable IME with GTK IM Module (selected by `GTK_IM_MODULE`) under
394+
wayland. However, IME popups might be incorrectly positioned.
395+
396+
3. Patch labwc and use [text-input-v1] protocol
397+
398+
Since [text-input-v1] is an outdated protocol, labwc doesn't officially
399+
support it. However, you can optionally add support for it by installing
400+
labwc from the [unofficial AUR](https://aur.archlinux.org/packages/labwc-im)
401+
or by applying its patch. Then, you can enable IME with [text-input-v1] by
402+
running Chromium with `--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-wayland-ime`.
403+
404+
[text-input-v3]: https://wayland.app/protocols/text-input-unstable-v3
405+
[input-method-v2]: https://wayland.app/protocols/input-method-unstable-v2
406+
[Configtool (Fcitx 5) - Fcitx]: https://fcitx-im.org/wiki/Configtool_(Fcitx_5)
407+
[text-input-v1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/unstable/text-input/text-input-unstable-v1.xml
408+
331409
[waybar repository]: https://github.com/Alexays/Waybar
332410
[waybar documentation]: https://github.com/Alexays/Waybar/tree/master/man
333411
[xfce4-panel repository]: https://gitlab.xfce.org/xfce/xfce4-panel

0 commit comments

Comments
 (0)