Skip to content

Which layouts count as Latin

Mike edited this page Oct 1, 2026 · 2 revisions

Which layouts count as Latin

Measured on 2026-10-01 for #33, with xkeyboard-config 2.48 and libxkbcommon 1.13.

The project switches to a Latin layout for passwords, so it has to know which layouts are Latin. Until 0.7.0 it went by layout code: a layout was Latin unless its code was in the list Omarchy uses to decide whether to put us first (ru, ua, gr, il, ara, …), or its variant was named *latin*.

The measurement

tools/xkb-latin.c compiles every layout and variant listed in xkeyboard-config's evdev.lst with libxkbcommon and counts how many of the letters a–z the base level (no Shift, no AltGr) of the main key block types. Shift is left out on purpose: the Israeli layout types Latin capitals with Shift, which says nothing about typing a password. The result is tests/xkb-latin.tsv in the repository.

Of 597 layouts and variants (one more, custom, does not compile):

letters a–z typed layouts
all 26 328
20–25 (Latin script, a few letters short: Esperanto, Turkmen, Azerbaijani, Sámi, Hausa, Yoruba…) 41
1–19 1 at 18 (in(iipa)), 3 at 1 (Indic scripts with one stray letter)
none 227

Latin means at least 20. Latin-script layouts a few letters short stay Latin, as before ("a Latin layout is left alone"); a script with a stray Latin letter does not.

How the old list did

Right for 512 of 597. Wrong for 85:

  • Called Latin, types no Latin letter (the harmful case: no switch, the password is typed in that script): pk (Urdu), eg, ma, dz(ar) (Arabic), uz (Uzbek Cyrillic), my (Burmese), bt, gn, tz, brai, Tibetan, Uyghur and Mongolian variants of cn, jp(kana), us(rus), de(ru), se(rus), cz(rus), the Baybayin variants of ph, and more.
  • Called non-Latin, types Latin (a needless switch between two Latin layouts): in(eng), the Latin Kurdish variants of iq, ir, sy, Crimean Tatar ua(crh*), ru(ruchey_en), ma(french) and a few more.

The common layouts (us, ru, ua, de, fr, Dvorak, Colemak, cz, tr, gr, il, by, kz…) were right either way.

What the code does now

isLatin() in src/compositor.cpp keeps three short tables derived from the measurement: 38 layout codes that are not Latin, 19 Latin variants of those, and 42 non-Latin variants of Latin layouts, plus the old rule that a *latin* variant is Latin. A test checks it against all 597 measured layouts.

Why not use libxkbcommon at run time

Considered and measured: compiling us,ru takes about 1.3 ms and leaves about 130 KB more private memory in the service (about half again what it uses), and libxkbcommon would be its first library dependency. It would also compile keymaps from names, which can differ from the keymap Hyprland really uses (kb_file, unusual kb_rules). Layouts change rarely, so a measurement redone when xkeyboard-config changes gives the same answers for free.

When xkeyboard-config changes

Rerun the measurement as the header of tools/xkb-latin.c says; if the test "layouts are Latin as measured" then fails, it names each layout that disagrees, and the tables in isLatin() need updating.

Clone this wiki locally