Insert both characters if a dead key combination is not recognized (e.g. 'a → á, 'b → 'b)
I found a way to make this work in OpenSUSE, and I hope it won't be too different in Mint. Maybe your files will be in slightly different locations, but it shouldn't be too hard to find the right ones.
OpenSUSE uses ibus
by default (or, at least, the Gnome version does), but I got rid of it and used xim
. I don't know if Mint also uses ibus
but, in any case, I'm posting the complete instructions. Skip/adapt the steps as necessary.
Uninstall
ibus
. In OpenSUSE, that'ssudo zypper rm ibus
. Logout and login again to kill the zombie daemons.Install
gtk3-immodule-xim
. In OpenSUSE, it'ssudo zypper in gtk3-immodule-xim
.Edit
/etc/X11/xim.d/none
. SetXMODIFIERS
to@im=none
. SetGTK_IM_MODULE
andQT_IM_MODULE
toxim
.cp /usr/share/X11/locale/en_US.UTF-8/Compose ~/.XCompose
. If there's a.XCompose
file in your home directory, X11 will use it. So now we can edit this file to customize the dead keys.Now, the boring part. Edit the
.XCompose
file and create rules for each combination of dead keys, outputting the desired string. For example:<dead_acute> <b> : "'b" <dead_acute> <r> : "'r" ...
Remember to create rules for uppercase letters, too (and punctuation, and anything you need).
If, like me, you also want to get cedilla (
ç
) instead of accented c (ć
) when using<dead_acute> <c>
, simply find and edit those lines too.
And there you have it. Logout and login again, and all the applications should handle input correctly!
EDIT: I'm aware that xim
is old and buggy (it says so on the config file), but the above was the only way I could get everything working. Maybe uim
also does the job.
On Ubuntu 14.04 I did the following:
1) Installed uim
using the Software Manager, other packages like uim-xim
, uim-gtk2
, uim-gtk3
and uim-qt
are auto installed. See https://launchpad.net/ubuntu/+source/uim.
2) Defined environmental variables by adding the next lines to ~/.profile
, this way the custom compose key sequences only apply to the current user:
# Restart the X-server after making alterations using:
# $ sudo restart lightdm
# It seems only GTK_IM_MODULE or QT_IM_MODULE needs to be defined.
export GTK_IM_MODULE="uim"
export QT_IM_MODULE="uim"
3) To mimic Window US International
keyboards I saved one of the following files at ~/.XCompose
:
- https://gist.githubusercontent.com/guiambros/b773ee85746e06454596/raw/0ea6d7f7cf9a6ff38b4cafde24dd43852e46d5e3/.XCompose or
- http://pastebin.com/vJg6G0th
This worked for me after 1) restarting Ubuntu or 2) just the X-server by entering the following command in a terminal:
$ sudo restart lightdm
NB: Restarting only seems necessary after altering the ~/.profile
file, alterations to ~/.XCompose
will take effect the next time an application (Terminal, Gedit, etc.) starts.
To check whether the environmental variables are set right, enter the following command in your terminal:
$ printenv | grep IM_MODULE
Many thanks to:
- https://wrgms.com/using-xcompose-with-chrome-and-sublime-text
About custom compose key sequences:
- http://manpages.ubuntu.com/manpages/trusty/man5/XCompose.5.html
- https://help.ubuntu.com/community/ComposeKey
About custom keyboard mapping:
- https://help.ubuntu.com/community/Custom%20keyboard%20layout%20definitions
Having 'a
and 'b
behave differently sounds annoying. I recommend that you use a different way to input characters with diacritics. Instead of making '
and such dead keys, use a compose key. To enter 'a'
, you type ' a ' normally. To enter á
, you type Compose ' a.
I'm not familiar with Mint's keyboard layout configuration interface but it should have an option to enable the Compose key somewhere. The usual choice is to use the “menu” key located to the left of the right Ctrl key (but that isn't always convenient on a laptop).
To keep things uniform, you can enable a Compose key on Windows with Wincompose.