Bug 2076596 - The KDE ibus panel is not able to switch keyboard layouts on Wayland
Summary: The KDE ibus panel is not able to switch keyboard layouts on Wayland
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: ibus
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: fujiwara
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 2082629 2100970 2142933 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-04-19 13:06 UTC by Lukas Ruzicka
Modified: 2023-11-04 05:50 UTC (History)
18 users (show)

Fixed In Version: ibus-1.5.29~beta1-1.fc39
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-07-31 12:48:04 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
The ibus panel with incorrect layout. (221.96 KB, image/png)
2022-04-19 13:06 UTC, Lukas Ruzicka
no flags Details
ibus warning message not translated (199.40 KB, image/png)
2022-04-24 11:35 UTC, Geraldo Simião
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github ibus ibus issues 2408 0 None open Keyboard layout changes do not work in Plasma Wayland 2023-06-20 02:40:33 UTC
Red Hat Issue Tracker FC-437 0 None None None 2022-04-26 07:36:38 UTC

Description Lukas Ruzicka 2022-04-19 13:06:20 UTC
Created attachment 1873514 [details]
The ibus panel with incorrect layout.

Description of problem:

I have freshly installed KDE Live 20220418 and made following settings during the installation:

* System language is English.
* Keyboard layout is Czech.

After the installation, the keyboard is correctly laid out to "czech" and uses the correct czech mappings. When I check for the system settings using `localectl status`, I get the same result:

===
System Locale: LANG=en_US.UTF-8
    VC Keymap: cz
   X11 Layout: cz
===

However, when I log into the KDE session, the IBUS-panel shows incorrectly "EN", but the layout is not English and even when I specifically select it using the panel, it does not have any influence.

Also, when I use the panel to add other languages, it does not affect the system layout which is used for the KDE session, as well as for applications (kwrite, konsole), which remains "czech" all the time.


Version-Release number of selected component (if applicable):
ibus-1.5.26-3
KDE Plasma 5.24.4

How reproducible:

Always

Steps to Reproduce:

1. Install KDE Live with non-english layout (as the only one)
2. Log into the newly installed session.
3. See if ibus-panel shows the correct layout.
4. Try using ibus-panel to modify keyboard layout in the KDE session.

Actual results:

ibus-panel cannot modify keyboard layout

Expected results:

ibus-panel should be able to modify keyboard layout or should not be the default method to do so.

Additional info:

See screenshot

Comment 1 Fedora Blocker Bugs Application 2022-04-19 13:10:25 UTC
Proposed as a Blocker for 36-final by Fedora user lruzicka using the blocker tracking app because:

 This violates the criterion about the basic functionality of default applications (https://fedoraproject.org/wiki/Fedora_36_Final_Release_Criteria#Default_application_functionality) or alternatively the default panel functionality (as the selector is placed in the panel) https://fedoraproject.org/wiki/Fedora_36_Final_Release_Criteria#Default_panel_functionality.

Comment 2 Matthew Miller 2022-04-19 18:03:32 UTC
Is this new to F36?

Comment 3 Geoffrey Marr 2022-04-19 18:58:57 UTC
Discussed during the 2022-04-19 blocker review meeting: [0]

The decision to classify this bug as an "AcceptedBlocker (Final)" was made as it violates the following criterion:

"All elements of the default panel (or equivalent) configuration in all release-blocking desktops must function correctly in typical use".

We also note it violates the spirit of the "keyboard layout configuration" criterion, which should be updated to require that switching work for default-switched configurations.

[0] https://meetbot.fedoraproject.org/fedora-blocker-review/2022-04-19/f36-blocker-review.2022-04-19-16.09.txt

Comment 4 fujiwara 2022-04-20 02:29:15 UTC
I guess you use Wayland session.
IBus panel runs setxkbmap internally so ibus cannot change the layout in Wayland.
You could run systemsettings5 and configure Input devices -> Keyboard instead.

The possible fix is to hide all XKB engines in Wayland but shows input method engines only in Wayland session.
I think the right fix is to integrate the IBus panel to Plasma Wayland compositor likes GNOME Wayland.

Comment 5 Fedora Update System 2022-04-20 11:54:36 UTC
FEDORA-2022-cc6ec114f7 has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-cc6ec114f7

Comment 6 fujiwara 2022-04-20 12:00:22 UTC
I hide XKB engines for Plasma Wayland for Fedora 36.
You need to run `ibus reset-config` after you install ibus-1.5.26-4.fc36.

Comment 7 Fedora Update System 2022-04-20 15:31:15 UTC
FEDORA-2022-cc6ec114f7 has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-cc6ec114f7`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-cc6ec114f7

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Lukas Ruzicka 2022-04-20 16:35:32 UTC
Thanks for the info. So, I can confirm that IBUS stopped showing the layouts on Wayland, hid the icon (although there is a placeholder left producing an unoccupied spot) and shows a warning that the layout settings do not work in Wayland and users should use systemsettings5 instead.

If this is how you want to solve this, I think it is sufficient for the time's being.

Comment 9 Adam Williamson 2022-04-21 16:03:00 UTC
fujiwara: "I think the right fix is to integrate the IBus panel to Plasma Wayland compositor likes GNOME Wayland."

is this something you can do, or does it need help from the KDE team? I agree the update should be 'enough' for release, but it would be nice to get the "right fix" done as a post-release update. Thanks!

Comment 10 Fedora Update System 2022-04-22 01:19:35 UTC
FEDORA-2022-cc6ec114f7 has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 11 fujiwara 2022-04-22 06:22:38 UTC
@awilliam:

I think it needs the help from KDE team since implementing Plasma Wayland compositor is complicated for me.
Currently one upstream bug exists: https://bugreports.qt.io/browse/QTBUG-96872

On the other hand, I will implement a new XKB setting in IBus in Fedora 37 to work with Wayland desktop. It would be nice to file another bug for ibus.

Comment 12 Adam Williamson 2022-04-22 14:34:19 UTC
We can re-open this bug for F37 and mark it as not release-blocking, I guess. It's basically the same problem, we just worked around it so far.

Comment 13 Geraldo Simião 2022-04-24 11:35:43 UTC
Created attachment 1874662 [details]
ibus warning message not translated

It seems warning is fine, but its only in English, even on other languages installations.
Screen capture of a fresh install from the iso F36-KDE-RC1.1 (Fedora-KDE-Live-x86_64-36-1.1.iso)

Comment 14 Adam Williamson 2022-04-24 15:28:58 UTC
Oh, yes, that's a good point :| As it was very newly added it's unlikely anyone translated it before we put it in the RC. We'll have to think whether it's worth getting it translated to at least the most common/active languages and respinning...

CCing i18n-bugs list.

Comment 15 Adam Williamson 2022-04-25 15:19:46 UTC
Gonna kick this back to F36 and 'proposed blocker' just for now so we can vote at the blocker review meeting on whether we need the text translated.

Comment 16 Geoffrey Marr 2022-04-25 18:13:42 UTC
Discussed during the 2022-04-25 blocker review meeting: [0]

The decision to consider this bug as sufficiently resolved was made as we agreed this was unfortunate but we have no realistic way to resolve it in an acceptable time frame, and at least the panel element is indeed disabled, so the criterion is satisfied.

[0] https://meetbot.fedoraproject.org/fedora-blocker-review/2022-04-25/f36-blocker-review.2022-04-25-16.00.txt

Comment 17 dacanizares 2022-05-27 17:27:11 UTC
We're using the following command and seems to be working on F36 on Wayland as a workaround to set our keyboard (system-wide) to US Int. With Dead Keys: ibus engine xkb:us:intl:eng

Comment 18 fujiwara 2022-06-25 14:54:06 UTC
*** Bug 2100970 has been marked as a duplicate of this bug. ***

Comment 19 fujiwara 2022-06-28 06:06:10 UTC
Evaluating QtWayland, seems Compositor handles XKB and the changing layouts does not exported to IM modules.
On the other hands, Plasma keyboard indicator is located at /usr/share/plasma/plasmoids/org.kde.plasma.keyboardlayout and seems the scripts accesses the Plasma APIs to change layouts.
IBus panel indicator uses libappindicator to send the IBus UI with D-Bus methods to Plasma panel at present.
Probably I think to migrate IBus panel to the plasmoids scripts for Plasma desktop but need more example implementations of the plasmoids.

Comment 20 Harish Karumuthil 2022-07-06 08:37:19 UTC
Hello all,
I just want to share a quick & dirty fix for this problem. 
This is an external python script https://github.com/harish2704/dotFiles/blob/master/home/.local/Apps/daily-utils/bin/ibus-next-engine.py .
It can switch to next input method if executed. 

Add a custom global shortcut ( for eg: Super+Space ) entry in settings menu and put the above script as target command for the shortcut.
We will get a minimal working Ibus in KDE plasma ( wayland )

Comment 21 Mike FABIAN 2022-07-13 11:41:49 UTC
(In reply to Harish Karumuthil from comment #20)
> Hello all,
> I just want to share a quick & dirty fix for this problem. 
> This is an external python script
> https://github.com/harish2704/dotFiles/blob/master/home/.local/Apps/daily-
> utils/bin/ibus-next-engine.py .
> It can switch to next input method if executed. 
> 
> Add a custom global shortcut ( for eg: Super+Space ) entry in settings menu
> and put the above script as target command for the shortcut.
> We will get a minimal working Ibus in KDE plasma ( wayland )

Thank you! 

But this does not switch the keyboard layout because ibus cannot switch the keyboard layout in KDE Wayland at the moment.
I.e. you can switch between “real” ibus engines like ibus-m17n, ibus-anthy, ibus-typing-booster, ... with your script. For example, if that part in your script returns:

$ ibus read-config | grep preload-engines | sed "s/preload-engines://g; s/'/\"/g"
   ["anthy", "m17n:t:latn-post", "kkc", "xkb:us:intl:eng", "xkb:mike::eng", "table:wubi-jidian86", "hangul", "libpinyin", "table:ipa-x-sampa", "typing-booster", "xkb:us:euro:eng", "xkb:de::deu", "table:cangjie5", "libzhuyin", "m17n:hi:itrans", "uniemoji", "m17n:t:unicode", "m17n:ru:translit", "m17n:mr:gamabhana", "xkb:ge::kat", "table:latex", "m17n:bn:national-jatiya", "OpenBangla", "table:jyutping"]


all the “engines” whose name starts with “xkb:” won’t work.

Comment 22 fujiwara 2022-09-12 11:00:23 UTC
*** Bug 2082629 has been marked as a duplicate of this bug. ***

Comment 23 fujiwara 2022-09-12 11:02:17 UTC
I created test packages to fix this issue.
https://copr.fedorainfracloud.org/coprs/fujiwara/ibus/


Could you update ibus and install ibus-qt5 and test the XKB layouts in Plasma Wayland?

Comment 24 fujiwara 2022-09-12 12:14:54 UTC
(In reply to fujiwara from comment #23)
> I created test packages to fix this issue.
> https://copr.fedorainfracloud.org/coprs/fujiwara/ibus/
> 
> 
> Could you update ibus and install ibus-qt5 and test the XKB layouts in
> Plasma Wayland?

I forgot to say you need to restart ibus-daemon and export QT_IM_MODULE=ibuswayland

Comment 25 fujiwara 2022-09-16 10:58:23 UTC
(In reply to fujiwara from comment #24)
> (In reply to fujiwara from comment #23)
> > I created test packages to fix this issue.
> > https://copr.fedorainfracloud.org/coprs/fujiwara/ibus/
> > 
> > 
> > Could you update ibus and install ibus-qt5 and test the XKB layouts in
> > Plasma Wayland?
> 
> I forgot to say you need to restart ibus-daemon and export
> QT_IM_MODULE=ibuswayland

Anyone tried to test the packages?

Comment 26 fujiwara 2022-11-16 10:51:58 UTC
*** Bug 2142933 has been marked as a duplicate of this bug. ***

Comment 27 Adam Williamson 2022-11-17 02:26:08 UTC
So, I tried that, and it sorta works but there's something odd. I wind up with one thing in the notification area that switches layouts correctly (it's colored white), and one which is colored blue, doesn't work to switch layouts, and keeps popping upa right-click menu without me right-clicking on it.

Comment 28 fujiwara 2022-11-18 08:59:17 UTC
(In reply to Adam Williamson from comment #27)
> So, I tried that, and it sorta works but there's something odd. I wind up
> with one thing in the notification area that switches layouts correctly
> (it's colored white), and one which is colored blue, doesn't work to switch
> layouts, and keeps popping upa right-click menu without me right-clicking on
> it.

Did you install ibus-qt5 and update ibus in the copr repo? and you need to run a QT application with QT_IM_MODULE=ibuswayland and could switch layouts with the focused QT application.

Comment 29 Adam Williamson 2022-11-18 17:19:25 UTC
Yes, I did all of those things. Before doing those things, I had zero switchers in the panel. After doing those things, I had *two*, one of which seems to work and one of which doesn't.

I'll see if I can create a new live image with the ibus build and see how that behaves, though it'd actually be easier with a scratch build than a COPR...

Comment 30 Ben Cotton 2023-04-25 18:24:04 UTC
This message is a reminder that Fedora Linux 36 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 36 on 2023-05-16.
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 '36'.

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. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 36 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 31 Adam Williamson 2023-04-28 00:00:34 UTC
I don't think anything ever got merged to mainline for this, so it's still an issue.

Comment 32 fujiwara 2023-06-20 02:40:34 UTC
I've been investigating this issue. Previously I tried to implement IBus Qt5 IM module but now I implemented Wayland input-method protocol in combined ibus-wayland and ibus-ui-gtk3 with the upstream discussion.

I provided the tentative implementation in IBus copr repo while there are some regressions:
https://copr.fedorainfracloud.org/coprs/fujiwara/ibus/

To use the new feature:
0. Log into Plasma Wayland desktop session
1. Delete QT_IM_MODULE environment variable. If you see QT_IM_MODULE from `env | grep ibus` command, you need to disable IBus with im-chooser utility.
2. Run systemsettings5 utility and select "Input Devices" -> "Virtual Keyboard" section and enable shows "IBus Wayland" icon.

Know issues:
1. Sometimes need to focus on input context in your application likes kwrite or konsole before you click IBus panel icon to show the active menu
2. Key typing sometimes gets into a infinite loop and you need to change the input focus.
3. IME switcher popup window soemetimes is not closed and you need to type another key to close it.
4. IBus panel icon sometimes is not open when logout and login the session again and you need to disable/enable "IBus Wayland" with systemsettings5.
5. Not implement emoji feature and X11 apps yet.

Comment 33 fujiwara 2023-07-18 06:26:09 UTC
Anyone try to test my copr repository above?
I have the plan to integrate the features ton Fedora 39 and close this issue.

Comment 34 Adam Williamson 2023-07-18 16:35:55 UTC
Thanks! I'm kinda swamped but if nobody else gets to it I will try to. *adds it to the mouldering pile of Browser Tabs With Something I Should Really Do In Them*

Comment 35 Adam Williamson 2023-08-10 06:03:16 UTC
sorry, I never did get time to get back to it yet :(

Comment 36 Adam Williamson 2023-08-11 21:17:25 UTC
It works! Great job.

I tested today's Rawhide KDE nightly, installing with English and Russian keyboards. On the installed system I have a switcher (just one, this time) in the panel which shows the correct layout ("us"). Clicking it changes it to say "ru", and it actually works: hitting keys now types Russian characters. Multiple switches all work fine.

Thanks!

Comment 37 David Warner 2023-11-04 05:50:18 UTC
Thanks for this - it was one of the last major issues stopping me from switching to the Wayland session.

(In reply to fujiwara from comment #32)
> 2. Run systemsettings5 utility and select "Input Devices" -> "Virtual Keyboard" section and enable shows "IBus Wayland" icon.

I found an annoying issue with the tab key when the IBus Wayland Virtual Keyboard is enabled. I opened a new bug here: https://bugzilla.redhat.com/show_bug.cgi?id=2247891

Hoping there's a quick fix (or that I'm doing something dumb)!


Note You need to log in before you can comment on or make changes to this bug.