Bug 2226646 - Maliit On Screen Keyboard Fails to Open Automatically On KDE Plasma Workspaces
Summary: Maliit On Screen Keyboard Fails to Open Automatically On KDE Plasma Workspaces
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: maliit-keyboard
Version: 38
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Jan Grulich
QA Contact:
URL:
Whiteboard: https://discussion.fedoraproject.org/...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-07-26 05:01 UTC by Keith Lyons
Modified: 2024-03-18 05:17 UTC (History)
10 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2024-03-18 05:17:14 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
maliit-keyboard.conf (3.95 KB, application/vnd.flatpak.ref)
2023-07-26 10:40 UTC, Akira TAGOH
no flags Details
mailiit-keyboard.conf (110 bytes, text/plain)
2023-07-27 07:22 UTC, Akira TAGOH
no flags Details
maliit-keyboard.conf (87 bytes, text/plain)
2023-07-28 08:41 UTC, Akira TAGOH
no flags Details
Updated proposed config file (125 bytes, text/plain)
2023-09-19 05:52 UTC, Akira TAGOH
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Fedora Pagure fedora-kde/SIG issue 371 0 None None None 2023-08-17 09:37:41 UTC

Description Keith Lyons 2023-07-26 05:01:49 UTC
#Issue

After the KDE Plasma Workspaces environment group has been installed (Fedora 38, x86_64), the following bugs occur when using the built in Maliit virtual keyboard:

* Post-login lockscreens cannot access virtual keyboard (only the initial sddm login screen has access).

* The keyboard does not pop up for text input areas automatically.

* If plasma-mobile is installed alongside the KDE Plasma Workspaces environment group, the mobile environment will suffer the two bugs listed above.

* The keyboard can be manually toggled on from the panel, but cannot be toggled off from the panel.

# Cause
This is happening because the KDE Plasma Workspaces environment group installs the Input Methods group. That group contains a package called imsettings-plasma, which includes a file: /etc/xdg/plasma-workspace/env/xinput.sh. In that file, there are two functions imported and called from another file: /usr/libexec/imsettings-functions. Those functions are as follows:

```
function setup_gtk_immodule() {
    if is_imsettings_enabled && is_gtk_supported; then
    # Ensure GTK_IM_MODULE is empty. otherwise GTK+ doesn't pick up immodule through XSETTINGS
    unset GTK_IM_MODULE
    export GTK_IM_MODULE
    else
    [ -n "$GTK_IM_MODULE" ] && export GTK_IM_MODULE
    fi
}

function setup_qt_immodule() {
    if is_imsettings_enabled && is_qt_supported; then
    # FIXME: Qt doesn't support XSETTINGS for immodule yet.
    #        We still need to go with the older way.
    [ -n "$QT_IM_MODULE" ] && export QT_IM_MODULE
    else
    [ -n "$QT_IM_MODULE" ] && export QT_IM_MODULE
    fi
}
```

The first function sets GTK_IM_MODULE to a non-null value, which prevents post-login lockscreens from having access to the virtual keyboard.

The second function is setting QT_IM_MODULE to a non-null value, which prevents the keyboard from popping up for text input areas, and from disappearing otherwise.

# Current workaround
Update the respective functions above to unset, the GTK_IM_MODULE and QT_IM_MODULE, regardless of the conditional logic. If those values are null, the Maliit keyboard works as intended for all use cases I listed previously.

Reproducible: Always

Steps to Reproduce:
1. Run `dnf group install "Input Methods" (should have happened automatically when distro was installed). Restart if Input Methods was not already installed
2. Use sddm to log into plasma desktop or plasma mobile
3. Enable Maliit keyboard. Toggle it on and off. 
4. Go to lock screen. Try to login with touch keyboard / click keyboard symbol. The keyboard won't pop up.
Actual Results:  
In step 3, Maliit won't toggle off in plasma desktop, and requires manual toggle on and off in plasma mobile.

In step 4- The virtual keyboard won't pop up - a physical keyboard must be used.

Expected Results:  
In step 3 - the keyboard should pop up automatically for text input areas, and disappear when a user selects a non text input area.

In step 4 - The keyboard should pop up automatically for touch, or optionally by clicking the keyboard symbol.

This has been cross posted in the Fedora KDE SIG issues tracker: https://pagure.io/fedora-kde/SIG/issue/371

Also, in plasma mobile, I believe that the keyboard symbol that is available in the upper right corner of the screen is a workaround for X11 applications. For instance, if you install the Slack flatpak, that keyboard symbol is the only way to use Maliit within the application, since it is X11. Automatic input only works for Wayland apps. I think something about the xinput.sh variables I listed in the cause section may be triggering X11 mode under all circumstances, but that's just a guess.

Comment 1 Akira TAGOH 2023-07-26 10:40:22 UTC
Created attachment 1980093 [details]
maliit-keyboard.conf

Please put this file under /etc/X11/xinit/xinput.d and then imsettings-switch Mallit

make sure you have a symlink $HOME/.config/imsettings/xinputrc to it then.
Once you restarting a plasma session, it should works as expected.

Comment 2 Keith Lyons 2023-07-26 17:52:18 UTC
It looks like that attachment is a flatpak related to flatseal. Can you confirm? I was expecting a text file.

Comment 3 Akira TAGOH 2023-07-27 07:22:37 UTC
Created attachment 1980227 [details]
mailiit-keyboard.conf

Oops, sorry. this should be correct one.

Comment 4 Keith Lyons 2023-07-28 02:21:25 UTC
Thanks for the quick turnaround, Akira! That did resolve the issue. Let me know if anything additional would be helpful on my end.

Comment 5 Akira TAGOH 2023-07-28 08:41:51 UTC
Created attachment 1980403 [details]
maliit-keyboard.conf

Probably no need to have DISABLE_IMSETTINGS line. So users can switch Input Method anytime by imsettings. we just need to own this in maliit-keyboard package.

Comment 6 Keith Lyons 2023-07-29 02:49:25 UTC
I can confirm that the bug remains resolved when the DISABLE_IMSETTINGS line is omitted (for English anyway).

Comment 7 Akira TAGOH 2023-09-19 05:52:04 UTC
Created attachment 1989511 [details]
Updated proposed config file

This requires imsettings-1.8.5

Comment 8 Akira TAGOH 2024-03-18 05:17:14 UTC
The above config may be still needed to avoid running maliit from imsettings though, this issue won't happens if no one use imsettings. "none" as default IM in imsettings prevents to work on Plasma Wayland now. so this could be fixed in next release.

If you still see this, please remove $HOME/.config/imsettings/xinputrc


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