8

When I use any variation of English, US international (with dead keys,altGr dead keys or alternative) on my Linux Mint machine I always encounter this behaviour.
When I press one of these keys: ' " and then follow them with a 'non-accentable' character like a [ or a b no output comes out at all.

Whereas in Windows US-International it would print [ or b. If I wanted to type this I would have to escape each dead key with a space instead of with any 'non-accentable' character. This is annoying when programming (not really, but I trained with the Windows 'Qwerty International' on typing.io and switching back and forth between the systems is irritating).

Is there any way to change that so it works like in Windows?

  • Note that <Compose>'b is a poor example, because there are actually valid compose sequences that begin with those characters, for example <Compose>'ba leads to . – Celada Aug 6 '15 at 21:08
4

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:

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:

About custom compose key sequences:

About custom keyboard mapping:

  • This works great. I wouldn't recommend using the second file (pastebin) to anyone though, since I made it and it's not nearly as complete as the first one, which I'm using now. – Jamie Holsten Aug 19 '15 at 21:18
  • Worked in Linux Mint 18 (Sarah),where installation of uim is done through keyboard input method (graphical window). I just needed to adjust environment variables in .profile/.bashrc, and install the ~/.XCompose file. – Luciano Sep 25 '16 at 16:09
  • The .XCompose files shared in the anser, both have issues. In the first the slash (/) become a kind of deakey, in the second dead keys cannot compose 'c or 'C in ç/Ç. I fixed it, changing the second .XCompose file from the link pastebin.com/vJg6G0th – Luciano Sep 27 '16 at 19:31
8

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.

  1. Uninstall ibus. In OpenSUSE, that's sudo zypper rm ibus. Logout and login again to kill the zombie daemons.

  2. Install gtk3-immodule-xim. In OpenSUSE, it's sudo zypper in gtk3-immodule-xim.

  3. Edit /etc/X11/xim.d/none. Set XMODIFIERS to @im=none. Set GTK_IM_MODULE and QT_IM_MODULE to xim.

  4. 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.

  5. 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).

  6. 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.

  • This is great. In Linux mint I just had to search for 'input method' inside start menu and I could switch to xim (skipping the first three steps). When I created the file in the home directory it worked. However, when I even give it one new command like: <dead_acute><r> : "'r" , it 'forgets' all dead keys (no more á,à,ã or ä) as well. So I have to set all the dead-key combinations manually, which is fine since I will always take that file with me to a new system. Can you tell me the keywords for ", ~ and ` as well(where is the reference for <dead_acute> from)? – Jamie Holsten Aug 7 '15 at 11:57
  • It's strange that it's forgetting the other dead keys, that doesn't happen here. Try putting the new rules at the end of the file, not at the beginning, and see if it helps. – cksk Aug 7 '15 at 17:46
  • By the way, an alternative to copying the entire Compose file to your local XCompose is to include the original: include "%L" on the first line. Then add the new rules below. (See here for details.) The other keywords are dead_diaeresis, dead_tilde and dead_grave. Just take a look at the original Compose file for others. – cksk Aug 7 '15 at 17:53
  • I could never find an original .XCompose file so far.My X11 folder doesn't have a 'locale' or a 'xim.d' folder. Maybe bcs. of the different distro or maybe because I changed to Xim via the GUI. I have a fresh install of LMint on my HDD now (instead of my USB-stick [not live] like before) and couldn't use dead keys at all. But your 'include "%L"' solved that problem somehow.Xim is very weird indeed.I´m almost done with making all the rules so it mirrors Microsoft Int. QWERTY perfectly.Could you give me a copy of your XCompose file,then I can get it done and put it up for everyone that wants it. – Jamie Holsten Aug 8 '15 at 20:17
  • I ran OpenSuse myself from a VM and got a file for reference. I'm almost done. The hardest part was figuring out how to express the "-sign, because it is used as a string-character in the encoding (it's actually \42 in octal and I could just write: <diaeresis> <b> : "\42b", 42 what a revelation). Now, I'll only have to correct mistakes and add all the special characters. I'll not do the third and fourth row, since it's too much work for too little payoff (so it wont work exactly like in Windows, but close enough for comfort). Thanks a lot for your input, I wouldn't have found that on my own. – Jamie Holsten Aug 11 '15 at 22:28
2

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.

  • No, it's not annoying at all, because you would never want to make a b (or any special character) with an accent on top. To me at least it's very intuitive and a great way to type my code in quickly and still type in my native language (also very quickly) without having to deal with annoying layout changes. I honestly couldn't get much into coding before I changed from QWERTZ, German to MS QWERTY,Int bcs. the special characters are so hard too reach. Also there is no other International layout anyway for Windows and I don't like the Ä being on my Q like in other alt+GR Int. layouts on Linux. – Jamie Holsten Aug 8 '15 at 20:31
  • 1
    The correct behavior is never annoying. What is annoying is spending 3 key presses to do what should by all rights take only two. Pro-tip: if someone asks how to do X, it pays not to answer by saying "you don't want to do X", ESPECIALLY when it concerns a usability issue. The default US Intl keyboards on linux are unusable, plain and simple. – Leandro M. Jun 11 '16 at 2:04
0

I couldn't get it all to work yet (couldn't figure out how to do some things yet like . ^ and & [probably octal values]), but it's good enough for me for now. When I do eventually complete it for the first/second level I'll reupload the properly modified .XCompose for xim. Thanks again for cksk for the help.

http://pastebin.com/vJg6G0th

0

To complete @lmeurs and @Luciano's answers above, here is a ~/.XCompose file that works as of June 2018 on Linux Mint 18.3, using xim as the input method:

include "%L" # or include "/usr/share/X11/locale/en_US.UTF-8/Compose"

<dead_acute> <b> : "'b"
<dead_acute> <c> : "ç"   ccedilla
<dead_acute> <d> : "'d"
<dead_acute> <f> : "'f"
<dead_acute> <g> : "'g"
<dead_acute> <h> : "'h"
<dead_acute> <j> : "'j"
<dead_acute> <k> : "'k"
<dead_acute> <l> : "'l"
<dead_acute> <m> : "'m"

<dead_acute> <n> : "'n"
<dead_acute> <p> : "'p"
<dead_acute> <q> : "'q"
<dead_acute> <r> : "'r"
<dead_acute> <s> : "'s"
<dead_acute> <t> : "'t"
<dead_acute> <v> : "'v"
<dead_acute> <w> : "'w"

<dead_acute> <x> : "'x"
<dead_acute> <y> : "'y"
<dead_acute> <z> : "'z"
<dead_acute> <B> : "'B"
<dead_acute> <C> : "Ç"   Ccedilla
<dead_acute> <D> : "'D"
<dead_acute> <F> : "'F"
<dead_acute> <G> : "'G"
<dead_acute> <H> : "'H"
<dead_acute> <J> : "'J"

<dead_acute> <K> : "'K"
<dead_acute> <L> : "'L"
<dead_acute> <M> : "'M"
<dead_acute> <N> : "'N"
<dead_acute> <P> : "'P"
<dead_acute> <Q> : "'Q"
<dead_acute> <R> : "'R"
<dead_acute> <S> : "'S"
<dead_acute> <T> : "'T"
<dead_acute> <V> : "'V"

<dead_acute> <W> : "'W"
<dead_acute> <X> : "'X"
<dead_acute> <Y> : "'Y"
<dead_acute> <Z> : "'Z"


<dead_acute> <dead_acute> : "''"
<dead_acute> <1> : "'1"
<dead_acute> <2> : "'2"
<dead_acute> <3> : "'3"
<dead_acute> <4> : "'4"
<dead_acute> <5> : "'5"
<dead_acute> <6> : "'6"
<dead_acute> <7> : "'7"
<dead_acute> <8> : "'8"
<dead_acute> <9> : "'9"
<dead_acute> <0> : "'0"
<dead_acute> <minus> : "'-"'
<dead_acute> <equal> : "'="
<dead_acute> <slash> : "'/"
<dead_acute> <bracketleft> : "'["
<dead_acute> <bracketright> : "']"
<dead_acute> <semicolon> : "';"
<dead_acute> <apostrophe> : "''"
<dead_acute> <comma> : "',"
<dead_acute> <period> : "'."
<dead_acute> <backslash> : "'\\"



<dead_acute> <dead_tilde> : "'~"
<dead_acute> <exclam> : "'!"
<dead_acute> <at> : "'@"
<dead_acute> <numbersign> : "'#"
<dead_acute> <dollar> : "'$"
<dead_acute> <percent> : "'%"
<dead_acute> <dead_circumflex> : "'^"
<dead_acute> <ampersand> : "'&"
<dead_acute> <asterisk> : "'*"
<dead_acute> <parenleft> : "'("
<dead_acute> <parenright> : "')"


<dead_acute> <underscore> : "'_"

<dead_acute> <plus> : "'+"
<dead_acute> <braceleft> : "'{"
<dead_acute> <braceright> : "'}"
<dead_acute> <colon> : "':"
<dead_acute> <quotedbl> : "'""
<dead_acute> <leftarrow> : "'<"
<dead_acute> <leftarrow> : "'>"
<dead_acute> <question> : "'?"


<dead_diaeresis> <dead_diaeresis> : "\"\""
<dead_diaeresis> <b> : "\42b"
<dead_diaeresis> <c> : "\42c"
<dead_diaeresis> <d> : "\42d"
<dead_diaeresis> <f> : "\42f"
<dead_diaeresis> <g> : "\42g"
<dead_diaeresis> <h> : "\42h"
<dead_diaeresis> <j> : "\42j"
<dead_diaeresis> <k> : "\42k"
<dead_diaeresis> <l> : "\42l"
<dead_diaeresis> <m> : "\42m"

<dead_diaeresis> <n> : "\42n"
<dead_diaeresis> <p> : "\42p"
<dead_diaeresis> <q> : "\42q"
<dead_diaeresis> <r> : "\42r"
<dead_diaeresis> <s> : "\42s"
<dead_diaeresis> <t> : "\42t"
<dead_diaeresis> <v> : "\42v"
<dead_diaeresis> <w> : "\42w"

<dead_diaeresis> <x> : "\42x"
<dead_diaeresis> <y> : "\42y"
<dead_diaeresis> <z> : "\42z"
<dead_diaeresis> <B> : "\42B"
<dead_diaeresis> <C> : "\42C"
<dead_diaeresis> <D> : "\42D"
<dead_diaeresis> <F> : "\42F"
<dead_diaeresis> <G> : "\42G"
<dead_diaeresis> <H> : "\42H"
<dead_diaeresis> <J> : "\42J"

<dead_diaeresis> <K> : "\42K"
<dead_diaeresis> <L> : "\42L"
<dead_diaeresis> <M> : "\42M"
<dead_diaeresis> <N> : "\42N"
<dead_diaeresis> <P> : "\42P"
<dead_diaeresis> <Q> : "\42Q"
<dead_diaeresis> <R> : "\42R"
<dead_diaeresis> <S> : "\42S"
<dead_diaeresis> <T> : "\42T"
<dead_diaeresis> <V> : "\42V"

<dead_diaeresis> <W> : "\42W"
<dead_diaeresis> <X> : "\42X"
<dead_diaeresis> <Y> : "\42Y"
<dead_diaeresis> <Z> : "\42Z"



<dead_diaeresis> <dead_acute> : "\42'"
<dead_diaeresis> <1> : "\421"
<dead_diaeresis> <2> : "\422"
<dead_diaeresis> <3> : "\423"
<dead_diaeresis> <4> : "\424"
<dead_diaeresis> <5> : "\425"
<dead_diaeresis> <6> : "\426"
<dead_diaeresis> <7> : "\427"
<dead_diaeresis> <8> : "\428"
<dead_diaeresis> <9> : "\429"
<dead_diaeresis> <0> : "\420"
<dead_diaeresis> <minus> : "\42-"
<dead_diaeresis> <equal> : "\42="
<dead_diaeresis> <slash> : "\42/"
<dead_diaeresis> <bracketleft> : "\42["
<dead_diaeresis> <bracketright> : "\42]"
<dead_diaeresis> <semicolon> : "\42;"
<dead_diaeresis> <comma> : "\42,"
<dead_diaeresis> <period> : "\42."
<dead_diaeresis> <backslash> : "\42\\"


<dead_diaeresis> <dead_tilde> : "\42~"
<dead_diaeresis> <exclam> : "\42!"

<dead_diaeresis> <at> : "\42@"
<dead_diaeresis> <numbersign> : "\42#"
<dead_diaeresis> <dollar> : "\42$"
<dead_diaeresis> <percent> : "\42"
<dead_diaeresis> <dead_circumflex> : "\42^"
<dead_diaeresis> <ampersand> : "\42&"
<dead_diaeresis> <asterisk> : "\42*"
<dead_diaeresis> <parenleft> : "\42("
<dead_diaeresis> <parenright> : "\42)"

<dead_diaeresis> <underscore> : "\42_"

<dead_diaeresis> <plus> : "\42+"
<dead_diaeresis> <braceleft> : "\42{"
<dead_diaeresis> <braceright> : "\42}"
<dead_diaeresis> <colon> : "\42:"
<dead_diaeresis> <quotedbl> : "\42\42"
<dead_diaeresis> <leftarrow> : "\42<"
<dead_diaeresis> <leftarrow> : ">"
<dead_diaeresis> <question> : "\42?"



<dead_grave> <b> : "`b"
<dead_grave> <c> : "`c"
<dead_grave> <d> : "`d"
<dead_grave> <f> : "`f"
<dead_grave> <g> : "`g"
<dead_grave> <h> : "`h"
<dead_grave> <j> : "`j"
<dead_grave> <k> : "`k"
<dead_grave> <l> : "`l"
<dead_grave> <m> : "`m"

<dead_grave> <n> : "`n"
<dead_grave> <p> : "`p"
<dead_grave> <q> : "`q"
<dead_grave> <r> : "`r"
<dead_grave> <s> : "`s"
<dead_grave> <t> : "`t"
<dead_grave> <v> : "`v"
<dead_grave> <w> : "`w"

<dead_grave> <x> : "`x"
<dead_grave> <y> : "`y"
<dead_grave> <z> : "`z"
<dead_grave> <B> : "`B"
<dead_grave> <C> : "`C"
<dead_grave> <D> : "`D"
<dead_grave> <F> : "`F"
<dead_grave> <G> : "`G"
<dead_grave> <H> : "`H"
<dead_grave> <J> : "`J"

<dead_grave> <K> : "`K"
<dead_grave> <L> : "`L"
<dead_grave> <M> : "`M"
<dead_grave> <N> : "`N"
<dead_grave> <P> : "`P"
<dead_grave> <Q> : "`Q"
<dead_grave> <R> : "`R"
<dead_grave> <S> : "`S"
<dead_grave> <T> : "`T"
<dead_grave> <V> : "`V"

<dead_grave> <W> : "`W"
<dead_grave> <X> : "`X"
<dead_grave> <Y> : "`Y"
<dead_grave> <Z> : "`Z"


<dead_grave> <dead_acute> : "`'"
<dead_grave> <1> : "`1"
<dead_grave> <2> : "`2"
<dead_grave> <3> : "`3"
<dead_grave> <4> : "`4"
<dead_grave> <5> : "`5"
<dead_grave> <6> : "`6"
<dead_grave> <7> : "`7"
<dead_grave> <8> : "`8"
<dead_grave> <9> : "`9"
<dead_grave> <0> : "`0"
<dead_grave> <minus> : "`-"
<dead_grave> <equal> : "`="
<dead_grave> <slash> : "`/"
<dead_grave> <bracketleft> : "`["
<dead_grave> <bracketright> : "`]"
<dead_grave> <semicolon> : "`;"
<dead_grave> <dead_grave> : "``"
<dead_grave> <comma> : "`,"
<dead_grave> <period> : "`."
<dead_grave> <backslash> : "`\\"


<dead_grave> <dead_tilde> : "`~"
<dead_grave> <exclam> : "`!"
<dead_grave> <at> : "`@"
<dead_grave> <numbersign> : "`#"
<dead_grave> <dollar> : "`$"
<dead_grave> <percent> : "`%"
<dead_grave> <dead_circumflex> : "`^"
<dead_grave> <ampersand> : "`&"
<dead_grave> <asterisk> : "`*"
<dead_grave> <parenleft> : "`("
<dead_grave> <parenright> : "`)"
<dead_grave> <underscore> : "`_"
<dead_grave> <plus> : "`+"
<dead_grave> <braceleft> : "`{"
<dead_grave> <braceright> : "`}"
<dead_grave> <colon> : "`:"
<dead_grave> <quotedbl> : "``"
<dead_grave> <leftarrow> : "`,"
<dead_grave> <leftarrow> : "`."
<dead_grave> <question> : "`?"


<dead_tilde> <b> : "~b"
<dead_tilde> <c> : "~c"
<dead_tilde> <d> : "~d"
<dead_tilde> <f> : "~f"
<dead_tilde> <g> : "~g"
<dead_tilde> <h> : "~h"
<dead_tilde> <j> : "~j"
<dead_tilde> <k> : "~k"
<dead_tilde> <l> : "~l"
<dead_tilde> <m> : "~m"

<dead_tilde> <n> : "~n"
<dead_tilde> <p> : "~p"
<dead_tilde> <q> : "~q"
<dead_tilde> <r> : "~r"
<dead_tilde> <s> : "~s"
<dead_tilde> <t> : "~t"
<dead_tilde> <v> : "~v"
<dead_tilde> <w> : "~w"

<dead_tilde> <x> : "~x"
<dead_tilde> <y> : "~y"
<dead_tilde> <z> : "~z"
<dead_tilde> <B> : "~B"
<dead_tilde> <C> : "~C"
<dead_tilde> <D> : "~D"
<dead_tilde> <F> : "~F"
<dead_tilde> <G> : "~G"
<dead_tilde> <H> : "~H"
<dead_tilde> <J> : "~J"

<dead_tilde> <K> : "~K"
<dead_tilde> <L> : "~L"
<dead_tilde> <M> : "~M"
<dead_tilde> <N> : "~N"
<dead_tilde> <P> : "~P"
<dead_tilde> <Q> : "~Q"
<dead_tilde> <R> : "~R"
<dead_tilde> <S> : "~S"
<dead_tilde> <T> : "~T"
<dead_tilde> <V> : "~V"

<dead_tilde> <W> : "~W"
<dead_tilde> <X> : "~X"
<dead_tilde> <Y> : "~Y"
<dead_tilde> <Z> : "~Z"


<dead_tilde> <dead_acute> : "~'"
<dead_tilde> <1> : "~1"
<dead_tilde> <2> : "~2"
<dead_tilde> <3> : "~3"
<dead_tilde> <4> : "~4"
<dead_tilde> <5> : "~5"
<dead_tilde> <6> : "~6"
<dead_tilde> <7> : "~7"
<dead_tilde> <8> : "~8"
<dead_tilde> <9> : "~9"
<dead_tilde> <0> : "~0"
<dead_tilde> <minus> : "~-"
<dead_tilde> <equal> : "~="
<dead_tilde> <slash> : "~/"
<dead_tilde> <bracketleft> : "~["
<dead_tilde> <bracketright> : "~]"
<dead_tilde> <semicolon> : "~;"
<dead_tilde> <comma> : "~,"
<dead_tilde> <period> : "~."
<dead_tilde> <backslash> : "~\\"


<dead_tilde> <dead_tilde> : "~~"
<dead_tilde> <exclam> : "~!"
<dead_tilde> <at> : "~@"
<dead_tilde> <numbersign> : "~#"
<dead_tilde> <dollar> : "~$"
<dead_tilde> <percent> : "~%"
<dead_tilde> <dead_circumflex> : "~^"
<dead_tilde> <ampersand> : "~&"
<dead_tilde> <asterisk> : "~*"
<dead_tilde> <parenleft> : "~("
<dead_tilde> <parenright> : "~)"

<dead_tilde> <underscore> : "~_"

<dead_tilde> <plus> : "~+"
<dead_tilde> <braceleft> : "~{"
<dead_tilde> <braceright> : "~}"
<dead_tilde> <colon> : "~:"
<dead_tilde> <quotedbl> : "~""
<dead_tilde> <leftarrow> : "~<"
<dead_tilde> <leftarrow> : ">"
<dead_tilde> <question> : "~?"

My /etc/environment contains:

GTK_IM_MODULE=xim
QT_IM_MODULE=xim

and I have added the following line to ~/.profile:

export XCOMPOSEFILE=/home/my-user-name/.XCompose

and of course I use the 'English(US, international with dead keys)' layout:

$ setxkbmap -query
rules:      evdev
model:      pc105
layout:     us
variant:    intl
options:    terminate:ctrl_alt_bksp

The only thing that does not work perfectly well (yet?) is that within Qt applications only one character can be output at a time ... so for example if you hit + whatever other key, only the apostrophe will be input.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.