text-input (IME) support for wayland

61 views
Skip to first unread message

David Arroyo

unread,
Apr 10, 2025, 7:25:01 AMApr 10
to plan9p...@googlegroups.com
Hello,

I have been using this fork of plan9port, which adds native wayland support, with the Sway compositor, for some time:

https://github.com/eaburns/plan9port/tree/wayland

I've added rudimentary support for wayland's text-input-v3 protocol to devdraw here:

https://github.com/droyo/plan9port/tree/wayland-im

This allows me to input Japanese and Vietnamese text into acme, sam, and 9term. There are some issues, but it is good enough for me to compose text in the languages I know, using the editors I like.

One limitation worth calling out is that I have no idea how to determine the position of the text cursor, since devdraw is lower in the stack. So for input methods like anthy (Japanese) which have a pop-up menu of candidates to select from, the menu will always show up at the same location.

Anyway, I feel I made many assumptions about my approach that may not hold up for every language, input method, or even every wayland compositor. So I'm reaching out here before opening a PR to get feedback from others. If you have time, please give it a try and let me know how well it works (or doesn't).

If you want to see a demonstration, I've uploaded a video at https://youtu.be/MQmk37xviSk

Cheers,
David Arroyo

lu...@lufia.org

unread,
Apr 24, 2025, 12:20:52 PMApr 24
to plan9port-dev
I am trying to use this on Sway.
For now, it works almost fine. I'm very happy to use Japanese IM.

I am using fcitx5+mozc. For pop-up menu's position, it doesn't bother me at all.

However, I noticed that INSTALL can't build fotnsrv if WSYSTYPE set to wayland because wayland.c does not exist in the directory. Is it expected?

2025年4月10日木曜日 20:25:01 UTC+9 David Arroyo:

David Arroyo

unread,
Apr 29, 2025, 8:10:46 PMApr 29
to 'Shoce' via plan9port-dev
Hi,

On Thu, Apr 24, 2025, at 01:25, 'lu...@lufia.org' via plan9port-dev wrote:
> I am trying to use this on Sway.
> For now, it works almost fine. I'm very happy to use Japanese IM.

Thanks for testing it! On my end I've noticed that when devdraw signals support for text-input-v3 to Sway, Sway generates its own key repeat events by simulating repeated key presses when you hold a key down, but it does not disable application-side key repeat with a wl_keyboard::repeat_info(0, 0) message. The result is that key repeat with this patch is unusably high on my version of sway. I haven't fully diagnosed the issue yet.

> I am using fcitx5+mozc. For pop-up menu's position, it doesn't bother me at
> all.

Yes, I've actually grown to prefer the menu popping up in the same place. And as I write more I need it less and less, anyway.

> However, I noticed that INSTALL can't build fotnsrv if WSYSTYPE set to
> wayland because wayland.c does not exist in the directory. Is it expected?

fontsrv only uses freetype, and not any x11 libs, so you should be able to build it without setting WSYSTYPE, which would produce the "x11" binary that works just fine under wayland. I'm not sure how you built it, but I don't set WSYSTYPE in my environment or LOCAL.config before building. The devdraw mkfile checks XDG_SESSION_TYPE to see if it's running on wayland.

Of course you could patch src/cmd/fontsrv/mkfile to select the x11 files for WSYSTYPE=wayland, too.

David
Reply all
Reply to author
Forward
0 new messages