HOWTO: Using Keyman for Linux with KDE
HOWTO: Using Keyman for Linux with KDE
Unfortunately when using the KDE desktop environment, the support for ibus (which Keyman for Linux uses underneath) isn’t that great.
Prequisites
As a prerequisite it is assumed that KDE Plasma, Wayland, and sddm are installed and working. This is the base for the steps described below. The steps may be appropriate for other configurations, too.
Installation and Configuration Steps
If you want to use Keyman with KDE you’ll have to do some manual steps.
Step 1 Install Keyman package
In a terminal window, run:
sudo apt update
sudo apt install keyman
If not installed, this command installs the ibus
package.
This is just an example for the apt package manager, on an other Linux platform there may be a different package manager and different package names.
Step 2 Provide the environment variables required for the ibus
input method framework
The environment variables "GTK_IM_MODULE"
and "QT_IM_MODULE"
must be set
to "ibus"
; "XMODIFIERS"
to "@im=ibus"
.
This can be achieved by setting them in the /etc/environment
file or by
putting a file containing the environment variables into the directory
$HOME/.config/environment.d
.
The format in both files is:
GTK_IM_MODULE=ibus
XMODIFIERS=@im=ibus
QT_IM_MODULE=ibus
Step 3 Auto-start the ibus daemon on every login
This can be achieved by providing a file ending with .desktop
in the
directory $HOME/.config/autostart
.
[Desktop Entry]
Exec=<some directory path>/ibus-start.sh
Icon=application-x-shellscript
Name=ibus-start
Type=Application
X-KDE-AutostartScript=true
The content of the ibus-start.sh
file is:
#!/bin/bash
ibus-daemon -dxrn kde
This may lead to an IBus Notification
message box after logging in.
IBus should be called from the desktop session in Wayland. For KDE, you can
launch 'systemsettings5' utility and go to "Input Devices"->"Virtual Keyboard"
icon and select "Ibus Wayland" and click "Apply" button to configure Ibus in
Wayland. (...)
One option is ignoring the IBus Notification
. IBus will be working.
Another option is to follow the instructions in the IBus Notification
. In this
case the local autostart actions are no longer required. Therefore before you
follow the instructions, remove the .desktop
file described above. Because
another autostart mechanism will be used.
Even then another IBus Notification
box may appear.
Please unset QT_IM_MODULE and GTK_IM_MODULE environment variables and
'ibus-daemon --panel disable' should be executed as a child process of
ibus-ui-gtk3 component.
Warning
Please do not follow these instructions. Leave the QT_IM_MODULE
and
GTK_IM_MODULE
environment variables set, otherwise some fonts won't be
correctly displayed with Keyman.
Step 4 Reboot so that the changes you made get applied to the new session
Now you should be able to use Keyman for Linux and add and use Keyman keyboards.
Adding input methods to IBus
Keyman keyboards installed have to be added to IBus as Input Method (Launcher->"System"->"IBus Preferences->"Input Method").
NOTE: it seems that some KDE specific programs like Konsole aren’t designed to work with ibus/Keyman keyboards. To test if a Keyman keyboard works you can e.g. test with gedit or LibreOffice Writer.