Set input method fonts only after the selection saves

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
David Heinemeier HanssonandClaude Opus 5.5 committed 2026-10-10 23:10:52 +09:00
1 parent d1e96fd86d
commit 2774a09e0b
2 files changed
+10 -2

No files matched your search

+2 -1
View File
@@ -117,11 +117,12 @@ def save_inputs(selected, overrides=None):
missing = [catalog.get(name, name) for name in selected if name not in available]
if missing:
raise RuntimeError("Restart input after updating Omarchy to use: " + ", ".join(missing))
set_inputs(group, layout, items, input_items(items, selected, overrides))
# Only a saved engine claims the CJK font fallback.
config_home = Path(os.environ.get("XDG_CONFIG_HOME") or str(Path.home() / ".config"))
for name in selected:
if name in setup.PRESETS:
setup.font_default(config_home, name)
set_inputs(group, layout, items, input_items(items, selected, overrides))
def keyboard_values(selected):
+8 -1
View File
@@ -36,7 +36,6 @@ class TypingSetupTest(unittest.TestCase):
self.assertEqual(catalog["cz:qwerty"], "Czech")
self.assertNotIn("az", catalog)
self.assertEqual(catalog["latam"], "Spanish (Latin American)")
self.assertEqual(catalog["latam"], "Spanish (Latin American)")
self.assertNotIn("us:intl", catalog)
self.assertLess(len(catalog), 60)
@@ -56,6 +55,14 @@ class TypingSetupTest(unittest.TestCase):
self.assertEqual(typing.input_items(items, ["mozc"]), [["keyboard-us", ""], ["mozc", ""], ["keyboard-fr", ""]])
self.assertEqual(typing.input_items(items, ["pinyin", "hangul", "mozc"]), items + [["pinyin", ""]])
def test_failed_input_save_leaves_fonts_alone(self):
with tempfile.TemporaryDirectory() as temporary:
before = ("Default", "us", [["keyboard-us", ""]])
with patch.dict(os.environ, {"XDG_CONFIG_HOME": temporary}), patch.object(typing.setup, "live_group", return_value=before), patch.object(typing.setup, "available_methods", return_value=[["mozc", "Mozc"]]), patch.object(typing, "set_inputs", side_effect=RuntimeError("rejected")):
with self.assertRaises(RuntimeError):
typing.save_inputs(["mozc"])
self.assertFalse((Path(temporary) / "fontconfig/conf.d/50-omarchy-input-method.conf").exists())
def test_cancellation_does_not_change_input_settings(self):
with patch.object(typing.setup, "live_group", return_value=("Default", "us", [["keyboard-us", ""]])), patch.object(typing, "input_catalog", return_value=({"mozc": "Japanese"}, {"mozc": "Japanese"})), patch.object(typing, "choose", return_value=None), patch.object(typing.setup, "live_set") as setter:
self.assertFalse(typing.configure_inputs())