Ir al contenido

Dead Keys and Compose Keys

Esta página aún no está disponible en tu idioma.

Use a composition table when a sequence of key presses produces a character. The table records what each press leaves pending and what the sequence eventually types. It can model dead keys, the Compose key on an XKB layout, and input methods that build or modify a character across several presses.

On Bépo, the circumflex stays pending until a vowel takes it, as in “â”; the accent can also be typed on its own.

Before typing
Nothing committed
Nothing pending
Keystrokes
Playback
Press Circumflex, then Space
Types ^
[composition]
commit_on_exit = false
[composition.states]
"^" = { display = "◌̂" }
[composition.transitions]
"" = { "^" = { next = "^" } }
"^" = { spc = "^", a = "â" }

The composition.transitions set the pending state with next. display controls the pending label; commit_on_exit controls what unfinished states emit.

Bépo keeps both accents pending together so the next vowel can take the circumflex and acute, as in “ấ”.

Press Circumflex, hold AltGr while pressing É, release AltGr, then press A
Types ấ
[composition.states."^´"]
display = "◌̂́"
[composition.transitions]
"^" = { "sym é" = { next = "^´" } }
"^´" = { a = "ấ" }

Here display names the pending label and next enters that state. The final string follows the composition.transitions rules for committed output.

To encode the X.Org Compose rule for “é”, enter a pending state on Compose, then select the acute accent with the apostrophe key.

Before typing
Nothing committed
Nothing pending
Keystrokes
Playback

The pending display is blank after Compose and shows the acute accent after the apostrophe. The last key commits “é” and returns to the start state, with no pending label.

[composition]
commit_on_exit = false
[composition.states]
compose = { display = "" }
"´" = { display = "◌́" }
[composition.transitions]
"" = { compose = { next = "compose" } }
compose = { "'" = { next = "´" } }
"´" = { e = "é" }

The composition.transitions use next for the two pending steps. The initial pending state has an empty display; commit_on_exit keeps incomplete input from committing by default.

While typing “바다” (sea) on Dubeolsik, the final vowel moves the pending “ㄷ” from the end of one syllable to the start of the next.

Before typing
Nothing committed
Nothing pending
Keystrokes
Playback

The same composition table can join two vowels in “왁”, or two final consonants in “읽”. Each syllable stays pending until it is committed.

Press Ieung, O, A, then Giyeok
Types 왁
Press Ieung, I, Rieul, then Giyeok
Types 읽

To turn “か” into “が” on JIS Kana, type the voicing mark after it; a contextual rule replaces the preceding kana.

Press Ka, then Dakuten
Types が
FieldUse
type = "dead_key"Bind an accent prefix that emits no text by itself.
labelSet its keycap and Inspector label. The label is not typed.
after_keysFor a contextual dead-key rule, match the prefix before the target press.
setIn that rule, give the target press an output object with value and delete_previous_output = true.
composition.transitionsList each Compose step by state and key. Use "" for the start state, next for a pending step and a string for a final result.
composition.states.<state>.displaySet the pending label to the mark or text shown on screen. Use an empty string for a pending state with no visible label.
composition.commit_on_exit = falsePrevent incomplete states from committing their display text by default.

Binding behaviors#

Dead key#

{ type = "dead_key", label = "◌̂" }

Declares a dead-key prefix that produces no text by itself. Define each supported composition with an after_keys rule naming this prefix and an output with delete_previous_output = true. The pair replaces the prefix’s empty output. This binding does not add an operating system Compose table.

In Try Out, an unmatched text-producing key or another dead key cancels the pending sequence with feedback and inserts no text from either key. Modifiers can still select a matching composition; Backspace cancels the prefix without removing earlier text. This scoped policy does not claim to reproduce every operating system’s fallback behavior.

The required label is displayed verbatim in the keyboard and rule references. Supply the complete legend, such as a dotted circle followed by a combining accent. The label is never typed or case-mapped. Inspect groups these keys in Notes with “This key is a dead key.”

Dead-key label#

label = "◌̂"

The complete display legend for a dead key. For example, ◌̂ identifies a circumflex prefix and ◌́ identifies an acute prefix on another layer. The renderer does not insert a dotted circle or infer an accent from the physical key ID.