Bug 1771836

Summary: ibus not responsive on wayland with sway as windowmanager
Product: [Fedora] Fedora Reporter: Christian Horn <chorn>
Component: ibusAssignee: fujiwara <tfujiwar>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 35CC: duck, i18n-bugs, shawn.p.huang, tfujiwar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-12-01 03:51:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
strace when running ibus-wayland from a terminal in sway none

Description Christian Horn 2019-11-13 06:10:41 UTC
Created attachment 1635626 [details]
strace when running ibus-wayland from a terminal in sway

Description of problem:
ibus not responsive on wayland with sway as windowmanager

Version-Release number of selected component (if applicable):
ibus-wayland-1.5.21-3.fc31.x86_64
ibus-1.5.21-3.fc31.x86_64
ibus-mozc-2.23.2815.102-8.fc31.x86_64

How reproducible:
always

Steps to Reproduce:
1. install Fedora31, select lxde-desktop-environment to get wayland installed
2. dnf -y install sway ibus-wayland ibus-mozc
3. useradd -m chris; passwd chris
4. Use this in the users .bashrc :
   [[ $(pgrep ibus-daemon) ]] || ibus-daemon --xim --daemonize -r
   export IMSETTINGS_INTEGRATE_DESKTOP=yes
   export IMSETTINGS_MODULE=ibus
   export QT_IM_MODULE=ibus
   export XMODIFIERS=@im=ibus
   export GTK_IM_MODULE=ibus
5. Boot system into multi-usermode, for example in setting it as default target
   and rebooting
6. login as user chris
7. run sway in executing 'sway'
8. get a terminal in pressing $mod + return (by default, $mod is the windows-key)
9. verify ibus-daemon is running: 'ps ax|grep ibus'
10. try to run ibuswayland: '/usr/libexec/ibus-wayland'

Actual results:
No input_method global

Expected results:
ibus-wayland should run, and I should be able to switch input method to mozc as configured with 'ibus-setup'.

Additional info:

- Might very well be an issue on my side.. but after trying this now for a week, taking that to bugzilla.

- fcitx4 from Fedora works under sway.

- When setting up ibus as above, I was never able to run ibus-wayland, and ibus did never react to attempts to switch the input method with shift+space or ctrl+space, I tried these combinations after setting them up with ibus-setup

- Instead of running ibus-daemon from user .bashrc, I did run it from sway directly.  Steps:
mkdir ~/.config/sway
cp /etc/sway/config ~/.config/sway/config
echo 'exec /usr/bin/ibus-daemon --xim --daemonize' >>~/.config/sway/config
The result is the same though.

- When running ibus-daemon non-daemonizing from a terminal, I get this:
[chris@космос ~]$ ibus-daemon -r -v

(ibus-ui-gtk3:75725): IBUS-WARNING **: 15:00:43.303: panel.vala:255: If you launch KDE5 on xterm, export XDG_CURRENT_DESKTOP=KDE before launch KDE5.

(ibus-ui-gtk3:75725): IBUS-WARNING **: 15:00:43.335: ibus_bus_call_sync: org.freedesktop.DBus.Properties.Get: GDBus.Error:org.freedesktop.DBus.Error.Failed: No global engine.

(and ibus-daemon stays running)

- I tried various terminals, for example xterm and terminator

Comment 1 fujiwara 2019-11-13 08:15:11 UTC
> echo 'exec /usr/bin/ibus-daemon --xim --daemonize' >>~/.config/sway/config

Did you run ibus-wayland too in the config?

Comment 2 Christian Horn 2019-11-13 08:57:39 UTC
(In reply to fujiwara from comment #1)
> > echo 'exec /usr/bin/ibus-daemon --xim --daemonize' >>~/.config/sway/config
> 
> Did you run ibus-wayland too in the config?

I tried 3 things, without success:

a) running both from sway, the config has this then:

 exec /usr/bin/ibus-daemon --xim --daemonize
 exec /usr/libexec/ibus-wayland

b) Without above 2 lines, and having this in the users .bashrc:
[[ $(pgrep ibus-daemon) ]] || ibus-daemon --xim --daemonize -r
/usr/libexec/ibus-wayland
export IMSETTINGS_INTEGRATE_DESKTOP=yes
export IMSETTINGS_MODULE=ibus
export QT_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export GTK_IM_MODULE=ibus

c) When sway runs, killing ibus-daemon and trying to run both manually:

[chris@космос ~]$ ibus-daemon --xim -r -v &
[1] 99796
[chris@космос ~]$ 
(ibus-ui-gtk3:99807): IBUS-WARNING **: 17:55:01.529: panel.vala:255: If you launch KDE5 on xterm, export XDG_CURRENT_DESKTOP=KDE before launch KDE5.

(ibus-ui-gtk3:99807): IBUS-WARNING **: 17:55:01.567: ibus_bus_call_sync: org.freedesktop.DBus.Properties.Get: GDBus.Error:org.freedesktop.DBus.Error.Failed: No global engine.

[chris@космос ~]$ 
[chris@космос ~]$ /usr/libexec/ibus-wayland
No input_method global
[chris@космос ~]$ 

Result seemed same for all of these, ibus-wayland did not get to run,
ctrl+space never switched to other methods (these are configured with
ibus-setup).

Comment 3 Christian Horn 2021-11-01 06:48:41 UTC
Still seeing this.

Interestingly, on sway in Firefox or Google chrome, I can use ibus to input Japanese.
Just not on xterm or the terminal emulator "terminator".

Comment 4 Christian Horn 2021-11-09 10:05:38 UTC
Also seeing this on 35.

Seems like the actual switching with hotkey is the problem, as I can switch
input method manually using for example
  ibus engine anthy

The hack from 
https://github.com/mpsq/arewewaylandyet/issues/41#issuecomment-842678375
is a possible workaround, it maps a key combination from Sway to do the
switching.  With the hack in place, switching is possible as it should,
just interestingly for me on xterm no hiragana-preview window appears.
GTK apps, firefox, terminator for example work fine with the hack.

Comment 5 Ben Cotton 2022-11-29 16:47:12 UTC
This message is a reminder that Fedora Linux 35 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 35 on 2022-12-13.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '35'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 35 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 6 Christian Horn 2022-12-01 03:51:40 UTC
Solved for me now on Fedora37, nice!

Setup details: https://fluxcoil.net/wiki/software/sway#japanese_inputibus

Bonus over fcitx5: when using fcitx and firefox in Wayland mode (not xorg emul), then the bookmarks can not be used, the menus do just flicker and can not be unfolded. Works nicely with ibus.