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 <noreply@anthropic.com>
This commit is contained in:
1 parent
4eda649324
commit
87c4e2c8b1
8 files changed
+19
-10
No files matched your search
@@ -36,12 +36,17 @@ function keyboard.vconsole()
|
|||||||
return read_values("/etc/vconsole.conf")
|
return read_values("/etc/vconsole.conf")
|
||||||
end
|
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()
|
function keyboard.installed()
|
||||||
local values = keyboard.vconsole()
|
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.XKBLAYOUT or "us") == "us"
|
||||||
and (values.XKBVARIANT or "") == "" then
|
and (values.XKBVARIANT or "") == "" then
|
||||||
values.XKBLAYOUT, values.XKBVARIANT = "kr", ""
|
values.XKBLAYOUT, values.XKBVARIANT = override, ""
|
||||||
end
|
end
|
||||||
return values
|
return values
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -174,8 +174,8 @@ def selection():
|
|||||||
preference = values(read(Path(os.environ.get("OMARCHY_INPUT_SELECTION", "/etc/omarchy/input-method"))))
|
preference = values(read(Path(os.environ.get("OMARCHY_INPUT_SELECTION", "/etc/omarchy/input-method"))))
|
||||||
layout = vconsole.get("XKBLAYOUT", "us").split(",")[0] or "us"
|
layout = vconsole.get("XKBLAYOUT", "us").split(",")[0] or "us"
|
||||||
variant = vconsole.get("XKBVARIANT", "").split(",")[0]
|
variant = vconsole.get("XKBVARIANT", "").split(",")[0]
|
||||||
if preference.get("XKB_LAYOUT") == "kr" and vconsole.get("XKBLAYOUT", "us") == "us" and not variant:
|
if preference.get("XKB_LAYOUT") in ("kr", "la") and vconsole.get("XKBLAYOUT", "us") == "us" and not variant:
|
||||||
layout, variant = "kr", ""
|
layout, variant = preference["XKB_LAYOUT"], ""
|
||||||
method = preference.get("INPUT_METHOD", "mozc" if layout == "jp" else "none")
|
method = preference.get("INPUT_METHOD", "mozc" if layout == "jp" else "none")
|
||||||
if method not in PRESETS:
|
if method not in PRESETS:
|
||||||
raise ValueError(f"Unknown installed input method: {method}")
|
raise ValueError(f"Unknown installed input method: {method}")
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ def keyboard_catalog():
|
|||||||
for choice in choices.splitlines():
|
for choice in choices.splitlines():
|
||||||
label, keymap, *input_settings = choice.split("|")
|
label, keymap, *input_settings = choice.split("|")
|
||||||
layout = input_settings[1] if len(input_settings) > 1 else mappings.get(keymap, keymap)
|
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.
|
# Composition engines belong in Input Methods, not as duplicate US layouts.
|
||||||
catalog.setdefault(layout, label)
|
catalog.setdefault(layout, label)
|
||||||
return catalog
|
return catalog
|
||||||
|
|||||||
@@ -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 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.
|
`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.
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ Japanese (US keyboard)|us|mozc
|
|||||||
Kazakh|kazakh
|
Kazakh|kazakh
|
||||||
Korean|us|hangul|kr
|
Korean|us|hangul|kr
|
||||||
Kyrgyz|kyrgyz
|
Kyrgyz|kyrgyz
|
||||||
Lao|la-latin1
|
Lao|us||la
|
||||||
Latvian|lv
|
Latvian|lv
|
||||||
Lithuanian|lt
|
Lithuanian|lt
|
||||||
Macedonian|mk-utf
|
Macedonian|mk-utf
|
||||||
@@ -114,7 +114,7 @@ omarchy_prompt_keyboard() {
|
|||||||
omarchy_persist_input_selection() {
|
omarchy_persist_input_selection() {
|
||||||
local target_root=${1:-} method=${keyboard_input_method:-none} layout=${keyboard_xkb_layout:-}
|
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 "$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"
|
mkdir -p "$target_root/etc/omarchy"
|
||||||
printf 'INPUT_METHOD=%s\nXKB_LAYOUT=%s\n' "$method" "$layout" > "$target_root/etc/omarchy/input-method"
|
printf 'INPUT_METHOD=%s\nXKB_LAYOUT=%s\n' "$method" "$layout" > "$target_root/etc/omarchy/input-method"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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"
|
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=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 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'
|
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'
|
||||||
|
|
||||||
|
|||||||
@@ -117,6 +117,10 @@ class InputMethodTest(unittest.TestCase):
|
|||||||
setup.defaults(self.config, fresh=False)
|
setup.defaults(self.config, fresh=False)
|
||||||
self.assertEqual(path.read_text(), "[Behavior]\nActiveByDefault=True\n")
|
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):
|
def test_korean_preference_yields_to_a_later_keyboard_change(self):
|
||||||
self.preference.write_text("INPUT_METHOD=hangul\nXKB_LAYOUT=kr\n")
|
self.preference.write_text("INPUT_METHOD=hangul\nXKB_LAYOUT=kr\n")
|
||||||
self.assertEqual(setup.selection(), ("hangul", "kr"))
|
self.assertEqual(setup.selection(), ("hangul", "kr"))
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ assert_status 0 "keyboard prompt succeeds"
|
|||||||
grep -qF -- '--selected English (US)' "$GUM_ARGS" || fail "keyboard prompt preselects English (US)"
|
grep -qF -- '--selected English (US)' "$GUM_ARGS" || fail "keyboard prompt preselects English (US)"
|
||||||
pass "keyboard prompt maps the chosen label to its keymap"
|
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"
|
IFS='|' read -r label keymap method layout <<< "$selection"
|
||||||
run_prompt omarchy_prompt_keyboard "0:$label"
|
run_prompt omarchy_prompt_keyboard "0:$label"
|
||||||
assert_status 0 "$label can be selected at install"
|
assert_status 0 "$label can be selected at install"
|
||||||
|
|||||||
Reference in new issue
Block a user