Shorter phrasing, same semantics.
Plasma Keyboard
The plasma-keyboard is a virtual keyboard and input engine designed to integrate in Plasma.
It uses the input-method-v1 Wayland protocol to communicate with the compositor to function as an input method. It also can leverage KWin's fake-input protocol in order to emulate keyboard keys (ex. Meta, Ctrl).
Install using the flatpak nightly repository
Flatpak manifest: org.kde.plasma.keyboard.flatpakref
See also: userbase.kde.org/Tutorials/Flatpak#Nightly_KDE_apps
Repository structure
Locations in the repo:
- layouts - Keyboard layouts
- kcm - Settings module
- src - Wayland input method (application), virtual keyboard, diacritics, etc.
- src/overlay - Overlay components for physical keyboard (diacritics)
- virtualkeyboard - Input engine and keyboard framework
Layouts
The keyboard layouts are located in the layouts folder.
See the existing layouts there for examples on creating layout packages. They are installed (roughly) to /usr/share/plasma/keyboard/keyboardpackages or ~/.local/share/plasma/keyboard/keyboardpackages/.
See the component library for making layouts for documentation at virtualkeyboard/components.
Text composers
A default text composer is provided that emits keys directly to the input engine (see directtextcomposer) which works for most languages.
Some languages require some extra processing in preedit to form words, and so have their own text composers:
Text composers are located in virtualkeyboard/textcomposers.
Troubleshooting
KWin by default only shows the keyboard when a text field is interacted with by touch. Set KWIN_IM_SHOW_ALWAYS=1 when starting KWin (or the login session) in order to force the keyboard to always pop up.
Development
Recommended methods for development are to either use KDE Linux (as your OS or in a VM), or to build the Flatpak version of plasma-keyboard.
KDE Linux (recommended)
Follow the instructions to set up a development environment for KDE software.
Build plasma-keyboard once to clone the source locally:
kde-builder plasma-keyboard
After making changes to the code the workflow is: rebuild, refresh sysext, and restart plasma-keyboard. This script can be used to do that:
#!/usr/bin/env bash
set -e
# Rebuild plasma-keyboard and refresh the sysext
kde-builder --no-src plasma-keyboard && systemctl --user daemon-reload && sudo systemd-sysext refresh --always-refresh=yes && systemctl restart --user plasma-plasmashell.service
# Disable plasma-keyboard
kwriteconfig6 --notify --file kwinrc --group Wayland --key InputMethod ''
# Enable plasma-keyboard with the newly built changes
kwriteconfig6 --notify --file kwinrc --group Wayland --key InputMethod '/usr/share/applications/org.kde.plasma.keyboard.desktop'
kde-builder (for most distributions)
For most distributions where you have kde-builder setup, you can test plasma-keyboard in a nested Plasma session.
Build plasma-keyboard:
$ kde-builder plasma-keyboard # For first run
$ kde-builder plasma-keyboard -DS # To build without dependencies
Ensure KWin uses your development version of plasma-keyboard by editing ~/.config/kwinrc:
~/.config/kwinrc
[Wayland]
InputMethod=~/kde/usr/share/applications/org.kde.plasma.keyboard.desktop
Run Plasma in a nested window:
$ KWIN_IM_SHOW_ALWAYS=1 dbus-run-session kwin_wayland "plasmashell"
In order to test keyboard navigation, pass an extra flag to KWin so that it would forward keyboard events:
$ KWIN_DEVICE_SKIPS_INPUT_METHOD="_none_" dbus-run-session kwin_wayland "plasmashell"
Flatpak
It is also possible to build plasma-keyboard as a Flatpak. This is the recommended method for development on distributions other than KDE Linux, as we don't want to install the development version of plasma-keyboard on a traditional Linux distribution (which may break the system).
Clone the repository and make changes to the code, then build and install the development version of the Flatpak with your changes by running the following from the repository root (or save as a script and run it):
#!/usr/bin/env bash
# Build and install the flatpak
flatpak-builder --user --install --force-clean build-flatpak .flatpak-manifest.json
# Disable plasma-keyboard if it is already running
killall plasma-keyboard; kwriteconfig6 --notify --file kwinrc --group Wayland --key InputMethod ''
# Enable plasma-keyboard with the newly built changes
kwriteconfig6 --notify --file kwinrc --group Wayland --key InputMethod '$HOME/.local/share/flatpak/exports/share/applications/org.kde.plasma.keyboard.desktop'
Building from source manually
mkdir build && cd build
cmake ..
make && make install
Troubleshooting
Join the KDE Matrix chat so we can help you get started with development! We have a room specifically for input handling: #kde-input:kde.org