By antonio

2018-04-23 14:09:36 8 Comments

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.


@Guildenstern 2019-03-13 19:29:41

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.

@roaima 2018-04-23 14:22:53

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.

@DopeGhoti 2018-04-23 16:04:43

Additionally, most .XCompose files include both AB and BA forms of the composition, so you can [Compose][a]['] or [Compose]['][a].

Related Questions

Sponsored Content

1 Answered Questions

[SOLVED] Dead keys - combining functionality -inconsistent

1 Answered Questions

[SOLVED] What happens when type dead key "acute accent" then "o" to produce "ó"?

  • 2018-12-20 19:02:25
  • Robert Vanden Eynde
  • 129 View
  • 2 Score
  • 1 Answer
  • Tags:   x11 xkb dead-keys

2 Answered Questions

Does Linux Mint have Windows-like dead keys?

5 Answered Questions

1 Answered Questions

How to use accent keys with US keyboard on OpenBSD 5.7?

2 Answered Questions

[SOLVED] Tuning keyboard (dead key) functionality in X

1 Answered Questions

[SOLVED] Can I disable dead keys for a single application?

Sponsored Content