I use an LG Gram 2-in-1 as my Linux laptop. Since it's a 2-in-1, I use it in tablet mode quite often. However, unfortunately Kubuntu doesn't ship with an on-screen keyboard by default.
I started off trying onboard
, but it wasn't able to detect when the laptop was in tablet mode. It also crashes when you hover over a keyboard button unless you switch the input source to GTK.
Switch to Wayland
Apparently KDE Plasma has better support for tablet mode under Wayland.
First, let's check what display server we are using:
echo $XDG_SESSION_TYPE
I am running Kubuntu 24.04, which uses KDE Plasma 5 running on X11. To switch to Wayland, we need to install the plasma-workspace-wayland
package:
sudo apt install plasma-workspace-wayland
After installing the package, log out and select Plasma (Wayland)
from the login screen to switch to Wayland.
Build and install Maliit
Next, we need to build Maliit from source, since I couldn't find any up to date PPAs for it.
Let's clone the following repositories:
Firstly, we need to install the build dependencies.
The easiest way to find the required dependencies is to look in the GitHub CI pipeline for framework and keyboard and see what packages are installed by the CI script.
sudo apt-get -y install build-essential cmake ...
Then, run the build commands from the framework README:
cd framework
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
make
sudo make install
The keyboard repo doesn't actually have explicit build instructions, but again, we can refer to the CI pipeline:
cd keyboard
cmake -DCMAKE_BUILD_TYPE=debug -DCMAKE_INSTALL_PREFIX=/usr .
make -j8
sudo make install
Finally, I had to manually compile the glib schemas:
sudo glib-compile-schemas /usr/share/glib-2.0/schemas/
And then we should be good to go! You can test everything worked by starting the Maliit server:
maliit-server
Set keyboard as default
Now, we just need to tell Kubuntu to use Maliit as the default keyboard. Go to System Settings
-> Input Devices
-> Virtual Keyboard
and select Maliit
.
You should also configure the input method using the im-config
tool.
- Run
im-config
- Select
Yes
to change the configuration - Select
activate Maliit input method framework
Change the theme
The default Maliit theme is in light mode, which contrasts with the dark theme I use.
I managed to find a fix which not only fixes the Maliit theme, but also the theme for other applications, as I found after switching to Wayland, some applications were not respecting the dark theme.
echo QT_QUICK_CONTROLS_STYLE="org.kde.desktop" | sudo tee -a /etc/environment
Conclusion
Now, I have a working on-screen keyboard that automatically pops up when I'm in tablet mode and I enter an input field.
Most applications support auto popup of the keyboard - you can tell which do because there will be a keyboard icon with a green dot in your taskbar.
For apps that don't support it like Google Chrome, the taskbar icon will change to an up arrow, which you can click to manually open the keyboard.