Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ibus+Mozc setup #4841

Closed
AdrienLemaire opened this issue Dec 26, 2019 · 10 comments
Closed

ibus+Mozc setup #4841

AdrienLemaire opened this issue Dec 26, 2019 · 10 comments

Comments

@AdrienLemaire
Copy link

Related issues: #873, #1225

I tried setting up mozc with ibus, but similarly to this HN comment, once the setup completed (with ibus' property panel always visible and ibus engine reporting mozc-jp), the prediction box doesn't show up and only alphabet letters are being typed.

I would have given up if it wasn't for one of the replies:

89nn 9 months ago
FYI I've been using ibus+anthy on sway for a while now, however recently switched to ibus+mozc because the prediction box in anthy started acting up/disappearing. Mozc seems to be working great so far (and actually what I wanted to use in the first place, but I believe I might have had the same issue you experienced)

This seems to confirm that ibus+mozc on sway is possible.

Anyone can share a working configuration?

local/ibus 1.5.21-3
    Next Generation Input Bus for Linux
local/ibus-mozc-ut2 2.23.2815.102.20171008-3 (mozc-im)
    IBus engine module for Mozc
local/libibus 1.5.21-3
    IBus support library
local/mozc-ut2 2.23.2815.102.20171008-3 (mozc-im)
    Mozc the Japanese Input Method with Mozc UT2 Dictionary

.local/bin/ibus-toggle

#!/usr/bin/env bash
engine=$(ibus engine)
if [ "${engine}" == "mozc-jp" ] || [ "${engine}" == "xkb:jp::jpn" ]
then
    ibus engine xkb:us::eng
else
    ibus engine mozc-jp
fi
setxkbmap -option caps:escape

.config/sway/config

# toggle input
bindsym $mod+i exec /home/dori/.local/bin/ibus-toggle

# japanese input
exec ibus-daemon -drx --panel /usr/lib/ibus/ibus-ui-gtk3

/usr/share/gdm/env.d/sway.env

# For japanese input with ibus & mozc
GTK_IM_MODULE=ibus
XMODIFIERS=@im=ibus
QT_IM_MODULE=ibus

commands I've found useful:

  • mozc conf: /usr/lib/mozc/mozc_tool --mod=config_dialog
  • ibus conf: ibus-setup
  • switch ibus: $mod+i
  • check env vars: env | grep -E 'XMOD|_IM'
  • ibus cli: ibus --help
@AdrienLemaire
Copy link
Author

AdrienLemaire commented Dec 26, 2019

hmmm ... actually, I have the exact same issue with Anthy.

$ pacman -S ibus-anthy
$ ibus restart
$ ibus setup  # and add anthy to input method
$ ibus engine anthy

The anthy panel shows up, and even if selecting Hiragana mode, only alphabet will be displayed.

Wondering how to debug and fix that issue. It can't be that all the apps I've tried input text into are not supporting ibus without more configuration (tried chromium-ozone, alacritty, termite), is it?

EDIT: after restarting the laptop, I can see kanjis printed in Anki (both anthy and mozc 🎉 ). It still doesn't work on chromium-ozone, alacritty and termite O_O.

  • Termite: ok, probably needs some Xresources amd xmodmap (X stuff on sway ?)
  • Alacritty: ok, probably never had japanese input support to start with
  • chromium-ozone: chromium too? that's a shock

@ammgws
Copy link
Contributor

ammgws commented Jan 8, 2020

Using ibus+mozc

kitty: doesn't work, though I have a feeling it did at one stage?
chrome (google): works

@AdrienLemaire
Copy link
Author

I switched to firefox, but realized (thanks xeyes) that both firefox-developer-edition (expected) and firefox-wayland-hg (unexpected) run under xwayland.
firefox supports mozc input (やった).

Saying thing because I'm thinking mozc issues are related to wayland apps only, and not xwayland ones.
This can be verified with Anki:

  • xwayland : mozc works fine in Anki input fields
  • pacman -S qt5-wayland
  • restart Anki, it'll auto-run on wayland and mozc doesn't work anymore.

@AdrienLemaire
Copy link
Author

AdrienLemaire commented Jan 8, 2020

Confirmed with Alacritty

image

Apps must run with xwayland for mozc to works properly.

Since this doesn't look related to sway anymore, I'll go and close the issue :)

@ammgws
Copy link
Contributor

ammgws commented Jan 8, 2020

I'm running firefox (nightly) natively and 日本語OK

@AdrienLemaire
Copy link
Author

@ammgws oh... Then I don't know why these problems occur.
Related issue tracked on Alacritty: alacritty/alacritty#2734

Should we re-open this ticket? I'm afraid sway has nothing to do with this issue ^^'

@ammgws
Copy link
Contributor

ammgws commented Jan 8, 2020

You can try running a different Wayland compositor (non-wlroots based one would be better I guess?) and seeing if it works there to be sure.

@AdrienLemaire
Copy link
Author

AdrienLemaire commented Jan 8, 2020

@ammgws I think I figured out the reason (but not the fix yet)

$ ps x|grep ibus
    996 ?        Ssl    0:05 ibus-daemon -drx --panel /usr/lib/ibus/ibus-ui-gtk3
   1009 ?        Sl     0:00 /usr/lib/ibus/ibus-dconf
   1014 ?        Sl     0:01 /usr/lib/ibus/ibus-ui-gtk3
   1018 ?        Sl     0:01 /usr/lib/ibus/ibus-extension-gtk3
   1026 ?        Sl     0:00 /usr/lib/ibus/ibus-x11 --kill-daemon                # WUT ?
   1034 ?        Sl     0:00 /usr/lib/ibus/ibus-portal
   1230 ?        Sl     0:01 /usr/lib/ibus/ibus-engine-simple
   1966 ?        Sl     0:00 /usr/lib/ibus-mozc/ibus-engine-mozc --ibus  

My sway config:

exec ibus-daemon -drx --panel /usr/lib/ibus/ibus-ui-gtk3

Somehow, ibus-daemon gets ibus-x11 to run instead of ibus-wayland.
To run ibus-wayland, I need some input_method

$ /usr/lib/ibus/ibus-wayland
No input_method global

From this comment, with weston we'd do:

[input-method]
path= /usr/lib/ibus/ibus-wayland

Now this becomes a request for sway to support this feature, which is a duplicate of #873

@ammgws
Copy link
Contributor

ammgws commented Jan 8, 2020

Perhaps this? #3407 / #4740

@xdavidwu
Copy link
Contributor

xdavidwu commented Jan 8, 2020

#4740 is for input-method-unstable-v2, but ibus needs input-method-unstable-v1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants