2

The US International keyboard allows to add diacritics by means of dead keys. Specifically:

`a maps to à and
'a maps to á.

In X, using the international or the standard US keyboard, I would like instead to set mappings like this:

a` maps to á and
a' maps to à.

As you can see, I would like the dead key to be typed after the base letter and also I prefer to swap the acute and grave accent dead keys. (This makes typing much faster and natural for me and, in case the dead key functionality is disabled, words with attached diacritics are more readable).

Can you address me to the proper tools/config files to achieve this?
In case it is relevant to the answer, my distro is Arch Linux.

  • And how would you enter a a without accent? Do you really want the typing of they're to produce theỳre? Or do you want to limit it to only a few base letters? – Stéphane Chazelas Apr 23 '18 at 14:30
  • 1
    You would have to handle this at the application level, since the a is typically already delivered to the application after it has been typed. – Johan Myréen Apr 23 '18 at 14:31
  • @JohanMyréen, one could imagine a generic handler that generates a Backspace key pressed, Backspace key released, à key pressed, à key released sequence of events when one presses ' while the last key event was for a a key. – Stéphane Chazelas Apr 23 '18 at 14:35
  • @Stéphane and then one can imagine all the edge cases which need to be handled ;-). The compose key seems like a much safer proposition... – Stephen Kitt Apr 23 '18 at 16:10
  • @StéphaneChazelas: There are no edge cases, unless you are typing maths. Accents are needed only for vowels, while apostrophes in English are used after consonants. When typing maths in technical documents, one would switch to the standard English keyboard. – antonio May 8 '18 at 17:55
6

One option is to use Compose mode

  1. Revert to your standard keyboard, rather than the US keyboard with deadkeys
  2. Enable compose mode. I happen to like Alt Gr as my compose key

To enter a letter with a diacritic you prefix the character pair with the chosen compose key. For example, Alt Gra' results in á. And Alt Gro/ results in ø. Alt Gr < < gives «. Etc.

  • 1
    Additionally, most .XCompose files include both AB and BA forms of the composition, so you can [Compose][a]['] or [Compose]['][a]. – DopeGhoti Apr 23 '18 at 16:04
0

No, I don’t believe there is a usable way to achieve this using “dead keys”. The other answer mentions the compose key. Well the compose key and dead keys function the exact same way, only using different mappings. Dead keys are essentially special-purpose compose keys.

The “dead key” concept is taken from typewriters where you can type for example ` without advancing the carriage, then type a over it and thus get à. The initial keypress is “dead” since the carriage stays in place.

Using letters (like a) as dead keys

There is nothing special about keysyms like Multi_key (the compose key), dead_greek, dead_circumflex, etc. You can use any keysym in your ~/.XCompose file. Thus using normal letters works perfectly fine:

<a> <grave> : "à"
<a> <acute> : "á"

The problem is that now you cannot just write a using one keystroke. You have to introduce mappings to effectively escape the “dead key”/mapping key functionality:

<a> <a> : "a"
<a> <space> : "a"

I can’t imagine that anyone would consider this a practical solution. Hence why I don’t think you can achieve what you want using compose key-style mappings.

Using combining diacritical marks

There is a way to type a + `à. You don’t even need compose key mappings. All you need to do is replace the dead keys with combining diacritical marks. These are Unicode glyphs that are meant to be combined with other glyphs. So if you want to type using this method:

a + ◌̀ → à (†1)

Some commonly used combining variants of diacritical marks:

  • ◌̀ U+0300 Combining Grave Accent
  • ◌́ U+0301 Combining Acute Accent
  • ◌̂ U+0302 Combining Circumflex Accent
  • ◌̃ U+0303 Combining Tilde
  • ◌̄ U+0304 Combining Macron

† 1: The (U+25CC DOTTED CIRCLE) is used to quote the combining diacritic mark.

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.