Skip to content

Add a Setup > Region toggle with Chinese sources, language and input method - #9519

Closed
ZacharyZhang-NY wants to merge 1 commit into
omacom:quattrofrom
ZacharyZhang-NY:china-region
Closed

ZacharyZhang-NY wants to merge 1 commit into
omacom:quattrofrom
ZacharyZhang-NY:china-region

Conversation

@ZacharyZhang-NY

@ZacharyZhang-NY ZacharyZhang-NY commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Setup > Region toggles the machine between World and China. Switching to China points the package registries for Node.js, Python, Rust, Go and Ruby at fast Chinese mirrors, switches the system language to Chinese (zh_CN.UTF-8, generated on demand, live from the next login), and sets up the Rime Ice Chinese input method through @manateelazycat's rime-ice-installer (AUR) — its TUI handles sudo, downloads the schema and grammar model, and restarts fcitx5 over dbus, all on the fcitx5 plumbing Omarchy already runs in every session. After the installer finishes, Rime is made the active default input method with Ctrl+Space pinned as the toggle, and the Omarchy menu itself puts on Chinese labels — a shipped omarchy-menu.zh-cn.jsonc (labels and titles only) installed through the stock user-extension overlay, which the shell hot-reloads. Switching back to World removes the source overrides, returns the language to en_US.UTF-8 and the menu extension to its shipped sample only when they are what Omarchy set, and leaves the input method installed.

Nothing is ever half-applied: every target is preflight-checked, and a registry someone configured by hand refuses the whole switch instead of being overwritten. World removes exactly the values Omarchy wrote (pip and gem are whole-file managed behind a marker, cargo uses a marked block, npm and go exact lines), and rewrites preserve file permissions — a 0600 .npmrc keeps its mode. The Arch and Omarchy mirrors themselves are deliberately not part of this; they wait on the Chinese mirror infrastructure. omarchy-region is registered as a menu guard reader since two rows read it.

The overlay also surfaced a latent menu bug: mergeMenuSources never implemented the field-level override documented in docs/menu.md — any label-only user extension clobbered the shipped entry's action/provider/icon with normalize-time defaults, silently hiding those rows. The merge now applies only the fields a file declares (and recomputes kind only when action or target was declared), with regression assertions in menu-test.sh.

Test plan

  • test/shell.d/region-test.sh (new, 15 cases): default World, China applies all five sources and installs the input method once, reapplying is idempotent, World removes exactly Omarchy's values and keeps foreign ones, refusals fire for hand-written npm/pip/cargo/go/gem configs — including a foreign registry hiding behind the Omarchy line and an early [source.crates-io] in a 20k-line config — unterminated cargo configs round-trip, .npmrc stays 0600, extra arguments are rejected, and the locale switch, fcitx5 activation, and menu-overlay round-trip (stock sample back on World) are exercised through mocks
  • test/shell.d/menu-test.sh asserts World and China under Setup > Region with their checked guards and actions, and validates the Chinese overlay (parses, ids stay a subset of shipped entries, labels and titles only); menu-guards-test.sh covers the new guard reader
  • ./test/all: no new failures against a clean-tree baseline
  • rime-ice-installer behavior verified from its source (packages installed --needed, fcitx5 restarted via dbus, profile keeps keyboard-us, env block lands in an inert file under Hyprland)

@ZacharyZhang-NY ZacharyZhang-NY changed the title Add a Setup > Region toggle with Chinese sources and input method Add a Setup > Region toggle with Chinese sources, language and input method Sep 1, 2026
…method

`omarchy region china` points npm, pip, cargo, go and gem at fast Chinese
mirrors, switches the system language to zh_CN (generated on demand, live from
the next login) and sets up the Rime Ice Chinese input method through Andy
Stewart's rime-ice-installer (AUR) — syncing the repo databases first, since a
fresh install has none until its first update — whose TUI drives its own sudo
and fcitx5 restart on the plumbing Omarchy already ships, then makes Rime the
active default with Ctrl+Space pinned as the toggle, and dresses the Omarchy
menu in Chinese labels through the stock user-extension overlay; `omarchy region world` takes
the source overrides back out, returns the language to en_US and the menu
extension to its shipped sample only when they are what Omarchy set, and
leaves the input method alone. Every target is
checked before anything is touched — a value someone else configured refuses
the whole switch rather than being overwritten, restores remove exactly the
values Omarchy wrote, and file permissions survive the rewrite. The Arch and
Omarchy mirrors themselves wait on the Chinese mirror infrastructure, and
omarchy-region joins the menu's guard readers since two rows read it.

Co-authored-by: Andy Stewart <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant