From 87c4e2c8b180ab9f1a55498de7b2146dc81522dd Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 11 Oct 2026 07:32:34 +0900 Subject: [PATCH] Give the Lao keyboard choice a Lao desktop layout The row used la-latin1, kbd's Latin American Spanish keymap, so Lao installs typed Spanish. There is no Lao console keymap; like Korean, the console stays US and the desktop gets la, which Omarchy keeps behind US as a non-Latin layout. Co-Authored-By: Claude Opus 5.5 --- default/hypr/keyboard.lua | 9 +++++++-- default/input-methods/configure.py | 4 ++-- default/input-methods/typing_setup.py | 2 -- docs/input-methods.md | 2 +- install/provisioning/setup-form.sh | 4 ++-- test/shell.d/hyprland-keyboard-layout-test.sh | 2 ++ test/shell.d/input-method-checks.py | 4 ++++ test/shell.d/setup-form-test.sh | 2 +- 8 files changed, 19 insertions(+), 10 deletions(-) diff --git a/default/hypr/keyboard.lua b/default/hypr/keyboard.lua index 11a5d3f5..1e293012 100644 --- a/default/hypr/keyboard.lua +++ b/default/hypr/keyboard.lua @@ -36,12 +36,17 @@ function keyboard.vconsole() return read_values("/etc/vconsole.conf") end +-- Choices whose console keymap is plain US but whose desktop layout is not: +-- Korean keeps US letters, and Lao is non-Latin, so US still leads. +local desktop_overrides = { kr = true, la = true } + function keyboard.installed() local values = keyboard.vconsole() - if read_values("/etc/omarchy/input-method").XKB_LAYOUT == "kr" + local override = read_values("/etc/omarchy/input-method").XKB_LAYOUT + if desktop_overrides[override] and (values.XKBLAYOUT or "us") == "us" and (values.XKBVARIANT or "") == "" then - values.XKBLAYOUT, values.XKBVARIANT = "kr", "" + values.XKBLAYOUT, values.XKBVARIANT = override, "" end return values end diff --git a/default/input-methods/configure.py b/default/input-methods/configure.py index ab659636..f4f691f6 100644 --- a/default/input-methods/configure.py +++ b/default/input-methods/configure.py @@ -174,8 +174,8 @@ def selection(): preference = values(read(Path(os.environ.get("OMARCHY_INPUT_SELECTION", "/etc/omarchy/input-method")))) layout = vconsole.get("XKBLAYOUT", "us").split(",")[0] or "us" variant = vconsole.get("XKBVARIANT", "").split(",")[0] - if preference.get("XKB_LAYOUT") == "kr" and vconsole.get("XKBLAYOUT", "us") == "us" and not variant: - layout, variant = "kr", "" + if preference.get("XKB_LAYOUT") in ("kr", "la") and vconsole.get("XKBLAYOUT", "us") == "us" and not variant: + layout, variant = preference["XKB_LAYOUT"], "" method = preference.get("INPUT_METHOD", "mozc" if layout == "jp" else "none") if method not in PRESETS: raise ValueError(f"Unknown installed input method: {method}") diff --git a/default/input-methods/typing_setup.py b/default/input-methods/typing_setup.py index c1d323ea..add64095 100644 --- a/default/input-methods/typing_setup.py +++ b/default/input-methods/typing_setup.py @@ -31,8 +31,6 @@ def keyboard_catalog(): for choice in choices.splitlines(): label, keymap, *input_settings = choice.split("|") layout = input_settings[1] if len(input_settings) > 1 else mappings.get(keymap, keymap) - if label == "Lao": - layout = "la" # Composition engines belong in Input Methods, not as duplicate US layouts. catalog.setdefault(layout, label) return catalog diff --git a/docs/input-methods.md b/docs/input-methods.md index 51b45525..de51b209 100644 --- a/docs/input-methods.md +++ b/docs/input-methods.md @@ -2,7 +2,7 @@ The install keyboard picker selects a console keymap plus an optional Fcitx engine. `install/provisioning/setup-form.sh` is shared by the ISO configurator and deferred first-boot owner setup. Its rows are `label|console keymap|input method|desktop XKB override`; the last two fields are optional, so ordinary keyboard choices keep their existing meaning. -The ISO carries the extra fields in `omarchy_install.input_method` and `omarchy_install.input_xkb_layout`. Both installation paths persist them in `/etc/omarchy/input-method` as `INPUT_METHOD` and `XKB_LAYOUT`. This file is parsed as data, never sourced. Korean has a real US console keymap and a `kr` desktop override; Japanese uses `jp106`, or US when the US-keyboard choice is selected. Console and disk-unlock input remain ordinary keymaps. +The ISO carries the extra fields in `omarchy_install.input_method` and `omarchy_install.input_xkb_layout`. Both installation paths persist them in `/etc/omarchy/input-method` as `INPUT_METHOD` and `XKB_LAYOUT`. This file is parsed as data, never sourced. Korean and Lao have a real US console keymap and a `kr` or `la` desktop override (Lao is non-Latin, so US still leads on the desktop); Japanese uses `jp106`, or US when the US-keyboard choice is selected. Console and disk-unlock input remain ordinary keymaps. `install/user/input-method.sh` calls `omarchy-input-method configure --seed` during user finalization, before graphical login. The standard engines are in the base package set so deferred provisioning and factory resets do not need network access to configure typing. `default/input-methods/presets.json` is the engine catalog used by the post-install selector. diff --git a/install/provisioning/setup-form.sh b/install/provisioning/setup-form.sh index c6118a57..e5ce3cb0 100644 --- a/install/provisioning/setup-form.sh +++ b/install/provisioning/setup-form.sh @@ -62,7 +62,7 @@ Japanese (US keyboard)|us|mozc Kazakh|kazakh Korean|us|hangul|kr Kyrgyz|kyrgyz -Lao|la-latin1 +Lao|us||la Latvian|lv Lithuanian|lt Macedonian|mk-utf @@ -114,7 +114,7 @@ omarchy_prompt_keyboard() { omarchy_persist_input_selection() { local target_root=${1:-} method=${keyboard_input_method:-none} layout=${keyboard_xkb_layout:-} case "$method" in none | mozc | hangul | pinyin | chewing) ;; *) return 1 ;; esac - case "$layout" in "" | kr) ;; *) return 1 ;; esac + case "$layout" in "" | kr | la) ;; *) return 1 ;; esac mkdir -p "$target_root/etc/omarchy" printf 'INPUT_METHOD=%s\nXKB_LAYOUT=%s\n' "$method" "$layout" > "$target_root/etc/omarchy/input-method" } diff --git a/test/shell.d/hyprland-keyboard-layout-test.sh b/test/shell.d/hyprland-keyboard-layout-test.sh index d88b0660..106fc7c3 100644 --- a/test/shell.d/hyprland-keyboard-layout-test.sh +++ b/test/shell.d/hyprland-keyboard-layout-test.sh @@ -148,6 +148,8 @@ sddm_layouts=$(sed -n '/^local non_latin_layouts =/,+1p' "$sddm_lua" | grep -o ' pass "greeter non-latin layout list stays in sync with the initramfs hook" TEST_INPUT_PREFERENCE=$'INPUT_METHOD=hangul\n XKB_LAYOUT="kr" # desktop only\n' assert_input "Korean selection overrides its installer US layout" "[kr] [] [$base_options]" $'XKBLAYOUT=us\n' +TEST_INPUT_PREFERENCE=$'INPUT_METHOD=none\nXKB_LAYOUT=la\n' assert_input "Lao selection gets Lao behind US on the desktop" "[us,la] [,] [$toggle_options]" $'XKBLAYOUT=us\n' +TEST_INPUT_PREFERENCE=$'INPUT_METHOD=none\nXKB_LAYOUT=xx\n' assert_input "an unknown desktop override is ignored" "[us] [] [$base_options]" $'XKBLAYOUT=us\n' TEST_INPUT_PREFERENCE=$'INPUT_METHOD=hangul\nXKB_LAYOUT=kr\n' assert_input "a later US variant overrides the Korean preference" "[us] [intl] [$base_options]" $'XKBLAYOUT=us\nXKBVARIANT=intl\n' TEST_INPUT_PREFERENCE=$'INPUT_METHOD=hangul\nXKB_LAYOUT=kr\n' assert_input "a later layout overrides the Korean preference" "[de] [nodeadkeys] [$base_options]" $'XKBLAYOUT=de\nXKBVARIANT=nodeadkeys\n' diff --git a/test/shell.d/input-method-checks.py b/test/shell.d/input-method-checks.py index 30baa8ec..176318ff 100644 --- a/test/shell.d/input-method-checks.py +++ b/test/shell.d/input-method-checks.py @@ -117,6 +117,10 @@ class InputMethodTest(unittest.TestCase): setup.defaults(self.config, fresh=False) self.assertEqual(path.read_text(), "[Behavior]\nActiveByDefault=True\n") + def test_lao_preference_keeps_a_latin_fcitx_keyboard(self): + self.preference.write_text("INPUT_METHOD=none\nXKB_LAYOUT=la\n") + self.assertEqual(setup.selection(), ("none", "us")) + def test_korean_preference_yields_to_a_later_keyboard_change(self): self.preference.write_text("INPUT_METHOD=hangul\nXKB_LAYOUT=kr\n") self.assertEqual(setup.selection(), ("hangul", "kr")) diff --git a/test/shell.d/setup-form-test.sh b/test/shell.d/setup-form-test.sh index 1cefa560..4f6d7f46 100755 --- a/test/shell.d/setup-form-test.sh +++ b/test/shell.d/setup-form-test.sh @@ -135,7 +135,7 @@ assert_status 0 "keyboard prompt succeeds" grep -qF -- '--selected English (US)' "$GUM_ARGS" || fail "keyboard prompt preselects English (US)" pass "keyboard prompt maps the chosen label to its keymap" -for selection in 'Japanese|jp106|mozc|' 'Japanese (US keyboard)|us|mozc|' 'Korean|us|hangul|kr' 'Chinese (Simplified, Pinyin)|us|pinyin|' 'Chinese (Traditional, Zhuyin)|us|chewing|'; do +for selection in 'Japanese|jp106|mozc|' 'Japanese (US keyboard)|us|mozc|' 'Korean|us|hangul|kr' 'Lao|us|none|la' 'Chinese (Simplified, Pinyin)|us|pinyin|' 'Chinese (Traditional, Zhuyin)|us|chewing|'; do IFS='|' read -r label keymap method layout <<< "$selection" run_prompt omarchy_prompt_keyboard "0:$label" assert_status 0 "$label can be selected at install"