maliit / keyboard

Maliit Keyboard, a free software virtual keyboard for Linux
GNU General Public License v3.0
149 stars 35 forks source link

after swiping down to hide keyboard, unable to call it back up #182

Open ishtob opened 1 year ago

ishtob commented 1 year ago

When running on non-wayland apps, the keyboard can be called by pressing the input method icon in the task bar, it works as normal until I got and swipe down ( pressing the input method icon again does not work for hiding). The virtual keyboard hides as it should, but going into another input field and trying to hit the input method icon, keyboard stays hidden.

Only way to get it to come back is to go to an app on wayland (for me firefox) and call the keyboard with any input field, then go back to the problematic app.

Blacklands commented 1 year ago

Same problem here, except I can't ever get it to come back up once it's gone. Need to reboot to make it show up again. Any news on this?

chenxiex commented 1 year ago

I have met the same problem. Switch to a wayland app doesn't work for me, but kill the process 'maliit-keyboard' is enough.

urbenlegend commented 7 months ago

Yeah, the user should be able to call the keyboard back up manually by swiping up from the bottom, or by tapping the keyboard icon in the tray. Currently, the tray icon just enables or disables the keyboard, which I feel is less useful.

XerTheSquirrel commented 6 months ago

I am using KDE Wayland on Debian and this happens to me as well. If I have the keyboard open and poke the window with the window property manager, it shows as being owned by kwin_wayland and being a Toolbar.

Once the keyboard is dismissed it never comes back until either:

XerTheSquirrel commented 6 months ago

If I very gently start to swipe down but then stop, the keyboard gets stuck and I cannot move it back up but I can move it more down until it dismisses. Part of me wonders if it is stuck below the screen or has like zero height.

image

XerTheSquirrel commented 6 months ago

Also as well, I find this in the dbus-monitor logs:

known reply_serial=2021
   string "The name org.maliit.server was not provided by any .service files"
method call time=1707850826.759681 sender=:1.126 -> destination=org.maliit.server serial=759 path=/org/maliit/server/address; interface=org.freedesktop.DBus.Properties; member=Get
   string "org.maliit.Server.Address"
   string "address"
error time=1707850826.759705 sender=org.freedesktop.DBus -> destination=:1.126 error_name=org.freedesktop.DBus.Error.ServiceUnknown reply_serial=759
   string "The name org.maliit.server was not provided by any .service files"
method call time=1707850826.759766 sender=:1.28 -> destination=org.maliit.server serial=743 path=/org/maliit/server/address; interface=org.freedesktop.DBus.Properties; member=Get
   string "org.maliit.Server.Address"
   string "address"
error time=1707850826.759905 sender=org.freedesktop.DBus -> destination=:1.28 error_name=org.freedesktop.DBus.Error.ServiceUnknown reply_serial=743
   string "The name org.maliit.server was not provided by any .service files"
method call time=1707850826.759921 sender=:1.135 -> destination=org.maliit.server serial=602 path=/org/maliit/server/address; interface=org.freedesktop.DBus.Properties; member=Get
   string "org.maliit.Server.Address"
   string "address"
error time=1707850826.759927 sender=org.freedesktop.DBus -> destination=:1.135 error_name=org.freedesktop.DBus.Error.ServiceUnknown reply_serial=602
   string "The name org.maliit.server was not provided by any .service files"
method call time=1707850826.760001 sender=:1.73 -> destination=org.maliit.server serial=1169 path=/org/maliit/server/address; interface=org.freedesktop.DBus.Properties; member=Get
   string "org.maliit.Server.Address"
   string "address"

Maybe KDE is trying to pop up the keyboard in this way but there is no endpoint in DBus?

XerTheSquirrel commented 6 months ago

Okay I promise to stop with the constant message spam and filling of the inbox with my constant squeaking, but I worked on a little script as a sort of workaround:

#!/bin/sh
# A bit of an indirect means of popping up the keyboard using a script/button or whatever...
# Written by Stephanie Gawroriski <xerthesquirrel@gmail.com>

# Because of this issue: https://github.com/maliit/keyboard/issues/182

# If the keyboard is running, we need to kill it
__pids="$(pidof -- maliit-keyboard)"
if [ -n "$__pids" ]
then
    kill -- $__pids 2> /dev/null
fi

# We need to turn off the virtual keyboard then turn it back on,
# just like a router!
# $HOME/.config/kwinrc:74:InputMethod[$e]=/usr/share/applications/com.github.maliit.keyboard.desktop
# VirtualKeyboardEnabled=true
__desktop="/usr/share/applications/com.github.maliit.keyboard.desktop"
__kwinrc="$HOME/.config/kwinrc"
__group="Wayland"
__imkey="InputMethod"
__enkey="VirtualKeyboardEnabled"

## Turn off
kwriteconfig5 --file "$__kwinrc" --group "$__group" --key "$__imkey" --delete
kwriteconfig5 --file "$__kwinrc" --group "$__group" --key "$__enkey" --delete

## Tell kwinrc to reconfigure itself
## There is no need to do a replace because that sets up a new pid and whatever else
## and would be the laggiest experience...
## Documentation is here: https://develop.kde.org/docs/plasma/kwin/
qdbus org.kde.KWin /KWin reconfigure

## Then back on, no idea what the [$e] is though, does not seem to matter?
kwriteconfig5 --file "$__kwinrc" --group "$__group" --key "$__imkey" "$__desktop"
kwriteconfig5 --file "$__kwinrc" --group "$__group" --key "$__enkey" --type 'bool' true

## Reconfigure again for the new settings
qdbus org.kde.KWin /KWin reconfigure

# If hidden is passed as the first argument, then do not pop up the keyboard
if [ -z "$1" ] || ! [ "$1" = "hidden" ]
then
    # Now we just request that the keyboard pop up
    # dbus-monitor gave me:
    # method call time=1707850043.477710 sender=:1.31 -> destination=org.kde.KWin serial=13810 path=/VirtualKeyboard; interface=org.kde.kwin.VirtualKeyboard; member=forceActivate
    # There needs to be a sleep here because kwin should be reloading now and
    # our keyboard would not be quite as ready... without the sleep windows will
    # not be automatically adjusted and the keyboard will just be non-functional
    sleep 0.5s
    qdbus org.kde.KWin /VirtualKeyboard forceActivate

    # Oddly there is this... maybe this is why KDE messes up?
    # method call time=1707850634.787426 sender=:1.81 -> destination=org.maliit.server serial=1104 path=/org/maliit/server/address; interface=org.freedesktop.DBus.Properties; member=Get
    #    string "org.maliit.Server.Address"
    #    string "address"
    # error time=1707850634.787443 sender=org.freedesktop.DBus -> destination=:1.81 error_name=org.freedesktop.DBus.Error.ServiceUnknown reply_serial=1104
    #    string "The name org.maliit.server was not provided by any .service files"
fi

Then using a plugin by himdek called Run Command and made a cute little button that is a replacement. Works well for me so far! Only downside is that it seems there is nowhere else for the keyboard to go so X11 and GTK apps are just bleh with it.

image

Then pressing the button gets this to happen, image is cut off at the bottom because for some reason KDE was not letting me move the capture rectangle to below the virtual keyboard:

Screenshot_20240213_141702

shiznix commented 5 months ago

Same problem here, currently switching to an active Konsole + back to workaround.

chenxiex commented 4 months ago

@XerTheSquirrel qdbus org.kde.KWin /KWin reconfigure seems not working. This script still works even if I delete the lines.

I've also tried use kwriteconfig5 to switch between input methods, and I found that it doesn't take effect after running qdbus org.kde.KWin /KWin reconfigure, but takes effect after kwin_wayland --replace.

XerTheSquirrel commented 4 months ago

@XerTheSquirrel qdbus org.kde.KWin /KWin reconfigure seems not working. This script still works even if I delete the lines.

I've also tried use kwriteconfig5 to switch between input methods, and I found that it doesn't take effect after running qdbus org.kde.KWin /KWin reconfigure, but takes effect after kwin_wayland --replace.

Interesting, seems broken now. I did the reconfigure dbus call so that I did not have to completely replace the kwin instance, which would reload the configuration as it is a new instance. Maybe there was a recent change to where it is ignoring or breaking the reconfigure? Does the input method change work if you were to go to System Settings manually and disable then enable it?

chenxiex commented 4 months ago

@XerTheSquirrel qdbus org.kde.KWin /KWin reconfigure seems not working. This script still works even if I delete the lines. I've also tried use kwriteconfig5 to switch between input methods, and I found that it doesn't take effect after running qdbus org.kde.KWin /KWin reconfigure, but takes effect after kwin_wayland --replace.

Interesting, seems broken now. I did the reconfigure dbus call so that I did not have to completely replace the kwin instance, which would reload the configuration as it is a new instance. Maybe there was a recent change to where it is ignoring or breaking the reconfigure? Does the input method change work if you were to go to System Settings manually and disable then enable it?

Yes, the input method change work if changed by the System Settings GUI.

I have noticed that when changing input method in System Settings, the process of the old input method will be killed and a new process of the new input method will be created. For example, if you switch to none or something else from maliit, the maliit-keyboard process will be killed automatically. When you switch back to maliit, the maliit-keyboard process will be created again. However, this never happens when changing with kwriteconfig5 and qdbus. Even if you kill maliit-keyboard manually after running kwriteconfig5 and qdbus, it just recreate a process of maliit-keyboard instead of creating a new process of the newly set input method. So I believe the configuration is not reloaded correctly.

twoexem commented 3 months ago

I've got a similar issue. When running Maliit in apps that don't support auto-detection of the keyboard (under KDE Wayland), then I can't summon Maliit again via the arrow after summoning it once unless I disable and re-enable Maliit via settings.

haizaar commented 1 month ago

Same problem here - the keyboard is usable only once:

It behaved like that in KDE5 and still does the same after upgrading to KDE6