2

My Window Manager/Desktop Environment has some applications where the dead keys (e.g.`, ~, ö) are not working by default, when I press then, they sometimes doesn't show at all on key press, sometimes they don't have the expected behavior('`'+ 'e'= è). They do work on some applications though, like here on firefox. How can I make they all work as expected in all applications ?

1 Answers1

1

Tutorial

Hello guys, I'm here to address this common problem we all once faced. The purpose of this tutorial is to solve this problem once for all. The information is out there, but is all over the place and sometimes we feel confused with the amount of different approaches that we can find to resolve this problem. Here, I'll try to synthesize all the information, so we can use our dead keys and compose symbols in any application.

This problem usually appears when we use a Window Manager(WM) or when our Desktop Environment(DE) is not properly configured.

The Solutions

There are two ways to address this problem:

  1. Disable Input Method Engine(IME) and use X11 to compose keys - This approach only works for latin languages characters.
  2. Properly configure iBus or Fcitx - This approach works for every language.

Here in this tutorial I'll address both approaches and talk a bit on why you should consider them.

Disable Input Method Engine(IME)

IMEs, like iBus or Fcitx are complexes engines built to compose non-latin characters languages (e.g. Japanese, Chinese, etc.)

If you don't need to type in those languages, there is really not a need for using either iBus or Fcitx, because X11 can handle pretty easy the task to compose the latin characters.

Disable iBus completely and use the system x11 to compose and use your dead keys.

How to:

These steps are taken from Janek Bevendorff's Answer

You gonna need these Environment Variables:

export GTK_IM_MODULE=""
export QT_IM_MODULE=""
export XMODIFIERS=""

You can set these variables either system-wide in /etc/profile (or a dedicated file inside /etc/profile.d, respectively) or inside your local ~/.xprofile. Setting it in ~/.bashrc or ~/.profile will not ensure that the lines will be executed when logging into your system using a graphical login manager such as GDM, SDDM, KDM or LightDM. If you are starting your X session using XDM, Slim or startx, you need to put those lines in ~/.xinitrc.

If you configured an input method other than ibus, go to Gnome settings afterwards and make sure any ibus-related settings are disabled, especially any keyboard shortcuts. Alternatively, tell Gnome not to touch your keyboard settings using:

gsettings set org.gnome.settings-daemon.plugins.keyboard active false

After that, restart your computer and test your faulty applications.


Properly configure iBus or Fcitx

If you need a very complex Input Method Engine for your language or if you do want the possibility to have it as an input method, you should follow these steps to properly configure your IME.

Here you have a choice, you can either go with iBus or Fcitx5, start first with what is installed in your Desktop Environment.

For those who uses a Window Manager with minimal installation, checkout iBus Arch Wiki and Fcitx5 Arch Wiki to make a proper decision.

How to:

1. Input Method Configuration

First in our system we need to setup the Input Method to be either iBus or Fcitx5.

In your terminal, type:

$ im-config

Then click OK, select YES (We wish to update the user configuration). In the next window, select the IME that you want (either ibus or fcitx), then OK and OK again.

You'll be told that you need to restart your system to make the configuration active.

2. Restart your computer.

3. Configure iBus or fcitx5

After your system restarts, configure your inputs methods through the GUI application

iBus
$ ibus-setup

It'll prompt you to start ibus-daemon, click YES (It is important that you don't have an script that autostart ibus-daemon in your system in this moment, otherwise the new ibus-daemon with the recent configured settings won't start.)

Fcitx5

See Fcitx5 Configuration

After configuring, we need to make sure that iBus daemon or fcitx daemon is running when our system starts.

For Desktop Environments, the autostart usually works out of the box. For us that use a Window Manager or if your ibus-daemon isn't autostarting in your Desktop Environment, we need to create a script to start our IME with our Session.

So in your ~/.xprofile file you'll need those lines:

For iBus
export GTK_IM_MODULES="ibus"
export QT_IM_MODULES="ibus"
export XMODIFIERS="@im=ibus"
ibus-daemon -drxR
For Fcitx5
export GTK_IM_MODULES="fcitx"
export QT_IM_MODULES="fcitx"
export XMODIFIERS="@im=fcitx"
fcitx5 -d

For more information on Fcitx5 autostart: Fcitx5 Arch Wiki

4. Test your applications

Now test if the applications are working correctly.

5. Restart your computer

This last restart is to check if the IME is autostarting after we configured them, if after this last restart, your applications are working fine, you can rest ease and focus on coding :)

That's it guys ! I hope after all this, your system is working properly, if you guys have any questions, please comment here and I'll try to help.

Cya !

*This post was originally made by me in JetBrains issue track Cannot type dead keys in Linux