electronkeyboarddebiangnome-3

Control Visibility of Gnome-3 On Screen Keyboard in Electron App


I'm working on an Electron application that is intended to run on a panel touchscreen computer running Debian. I have enabled the on-screen keyboard board in desktop settings and can see it come up in other applications (such as terminal). However, the on screen keyboard does not come up inside of my electron app when a text input gains focus. I have read that this might be some sort of weirdness with Chromium (see https://askubuntu.com/questions/939616/why-the-onboard-on-screen-keyboard-doesnt-auto-show-in-google-chrome) but have unable to find any workarounds. I suppose that my question is in two parts: 1 - is there anything that I can do to get Electron to play nicely with the gnome 3 built in keyboard? 2 - is there any program that I can call that would show and/ or hide the on-screen keyboard?

The OS that I am targeting is Debian version 10.3 with the Gnome desktop.


Solution

  • After quite a bit of research, I learned that, in order to trigger the on-screen keyboard for Gnome, an application must be developed around GTK. Any application that fails to do so is considered "foreign" on the Gnome desktop. Apparently, Chrome falls into this category and Electron built apps as well because they are built on Chromium. With all that said, it is still possible for a foreign application to send on-screen keyboard events through dbus. The issue at CentOS On screen keyboard not showing for Jawa Swing Text entry fields describes these events as follows: To turn the keyboard on:

    dbus-send --type=method_call --dest=org.gnome.Caribou.Keyboard /org/gnome/Caribou/Keyboard org.gnome.Caribou.Keyboard.Show uint32:0
    

    To turn the keyboard off:

    dbus-send --type=method_call --dest=org.gnome.Caribou.Keyboard /org/gnome/Caribou/Keyboard org.gnome.Caribou.Keyboard.Hide uint32:0