[feat] Restore upstream's CJK font and fcitx5, add Traditional Chinese - #188
Open
k5953837 wants to merge 12 commits into
Open
[feat] Restore upstream's CJK font and fcitx5, add Traditional Chinese#188k5953837 wants to merge 12 commits into
k5953837 wants to merge 12 commits into
Conversation
Generate zh_TW.UTF-8 alongside en_US.UTF-8 without changing the default LANG or KEYMAP, seed an fcitx5 profile that keeps the US keyboard first and Chewing second, append --enable-wayland-ime to upstream's Chromium flags, and prefer the Traditional Chinese Noto CJK face for zh-tw and zh-hant text. XMODIFIERS is set for XWayland clients only. GTK_IM_MODULE and QT_IM_MODULE stay unset so native Wayland GTK4 and Qt6 applications keep using text-input-v3, which Hyprland implements. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Assert that zh_TW.UTF-8 is generated without displacing the English default, that the seeded fcitx5 profile keeps the US keyboard first, that Chromium's upstream flags are appended to rather than replaced, that Traditional Chinese glyphs win for zh-tw and zh-hant text, and that GTK_IM_MODULE and QT_IM_MODULE are never assigned. The last check parses non-comment lines so it keeps passing while the environment file explains in prose why those variables stay unset. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
configure-rootfs.sh appends to upstream's chromium-flags.conf, so declare it in authenticity.requiredPaths the way config/hypr/monitors.lua already is. An upstream rename is then caught during source verification instead of part way through a build. Also add the architecture note the other guest overlay additions have, and condense the fontconfig comment to the two reasons that carry weight. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
fcitx5 substitutes the second item when a group's requested default names the first, and rewrites DefaultIM to that resolved value on save, so DefaultIM=keyboard-us has no effect here. What keeps an untouched session on plain US input is keyboard-us occupying item index 0, combined with input contexts starting inactive. Assert the section and name pair for both items, and record the reasoning in the profile fragment so the ordering is not "corrected" later. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Read tryomarchy.locale from the kernel command line and write LANG into /run/environment.d, the runtime tier of the same mechanism the factory overlay already uses to deliver XMODIFIERS. Without the token nothing is written, so an English boot is unchanged. The value reaches the session environment, so only the two locales configure-rootfs.sh generates are accepted; anything else is ignored rather than interpolated. /etc/locale.conf, LC_ALL and the console keymap are left alone. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Add a Language row beside the other integrations. Choosing Traditional Chinese stores the locale in the same preference shape the other settings use, threads OMARCHY_QEMU_GPU_LOCALE through the launch-configuration chain, and run-qemu-gpu.sh turns it into the tryomarchy.locale kernel argument the guest generator reads. The launcher re-validates the value against the locales the guest image generates rather than trusting the environment, and fails loudly on an unknown one: unlike the kernel command line, that value comes from our own code, so a bad one is a bug rather than something to shrug off. Leaving the setting alone emits no environment variable and no kernel argument, so an English launch is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Give the feature its own README section alongside the other opt-in start-menu integrations, and widen the architecture note to cover the host-side choice and the kernel argument that carries it. State plainly that Omarchy's own setup wizard and menus remain English: upstream has no translation mechanism and those strings are hardcoded in its shell scripts, so a reader should know before switching rather than after. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Derive both sides of the allowlist check from source rather than restating a locale list, so the generator and configure-rootfs.sh cannot drift apart and leave a chosen language with no LANG. Add behavioural tests that run the generator as a subprocess with /proc/cmdline and its output directory redirected into a temporary directory: an off-allowlist value, an empty value and a value carrying shell metacharacters must each write nothing, which string matching alone cannot establish. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Upstream Omarchy already ships noto-fonts-cjk, fcitx5, fcitx5-gtk and fcitx5-qt in install/omarchy-base.packages; this fork's trimmed transaction drops all four, which is why Chinese renders as tofu and there is no way to type it. Put them back and add fcitx5-chewing for Bopomofo. fcitx5-configtool is deliberately left out: upstream does not ship it either, and it drags in a KDE dependency chain for a GUI the seeded profile makes unnecessary. The refreshed lock adds exactly nine packages and changes no existing version. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The generator wrote LANG into /run/environment.d, and measurement in a booted guest showed why that never took effect: Omarchy starts its session through uwsm, which merges the login shell's environment back into the user manager after the environment.d generators have run. The login shell takes LANG from /etc/locale.conf via PAM, so English always won. Write /etc/locale.conf from a oneshot unit ordered before both session entry points instead. An absent or unrecognised token writes the image default rather than nothing, so switching back to English in the start menu also takes effect on a VM that has already run in Chinese. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Both notes still described the systemd generator this branch replaced, and named /run/environment.d rather than the file the login shell actually reads. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Arch Linux ARM rotated the kernel and orc while this branch was in progress, and the versions the previous lock named are no longer served, so a build from it fails before it starts. These three are what the same --refresh-package-lock run resolves today; the nine packages this branch adds are unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Author
|
CI is sitting at For what it is worth, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #175.
Summary
The factory guest cannot display or type Traditional Chinese. It generates only
en_US.UTF-8, ships no CJK font, and omits fcitx5, so Chinese renders as tofuboxes with no way to enter it.
Most of what is missing was never Omarchy's decision. At the pinned release
(4.0.2,
346e69e1c),install/omarchy-base.packagesalready contains:guest/packages.txt— the intentionally trimmed ARM64 transaction — drops allfour. This restores them, adds
fcitx5-chewingfor Bopomofo, and supplies theTraditional-Chinese-specific configuration upstream does not: a
zh_TW.UTF-8locale, a fontconfig rule that picks TC Han glyph variants over Simplified or
Japanese ones, and a way to choose the language.
That trim has already cost one bug: #91, where the omitted
fcitx5binary leftupstream's
omarchy-fcitx5.servicein a 203/EXEC restart loop. TheConditionPathExists=/usr/bin/fcitx5drop-in added in #106 is self-healing —installing the package makes it pass with no change to the guard.
What changes
noto-fonts-cjk,fcitx5,fcitx5-gtk,fcitx5-qt; addfcitx5-chewingzh_TW.UTF-8alongsideen_US.UTF-8inconfigure-rootfs.shetc/fonts/conf.d/30-try-omarchy.confpreferringNoto Sans/Serif/Mono CJK TCforzh-twandzh-hant/etc/skel/.config/fcitx5/profilewithkeyboard-usfirst,chewingsecondXMODIFIERS=@im=fcitxinenvironment.d--enable-wayland-imeto upstream's/etc/skel/.config/chromium-flags.confHow the choice reaches the guest
The Language row stores a preference the same way Shared folder, Port forwarding
and Resources do,
run-qemu-gpu.shturns it into atryomarchy.locale=kernelargument the way it already derives
tryomarchy.ssh_access=1, and a guestoneshot unit writes
/etc/locale.confbefore either login entry point starts.Leaving the row alone emits no environment variable and no kernel argument, so
an English launch is byte-identical to today. Both sides validate the value
against the locales the image actually generates; the host fails loudly on an
unknown one because that value comes from our own code, while the guest ignores
it silently because the kernel command line does not deserve that trust.
Beyond #175
#175 proposed the guest-side restore only. The Language row is not in it. I
added it because the guest half alone leaves a user with a working locale and no
way to select it short of editing
/etc/locale.confby hand, and because itneeded no new mechanism — it is the same preference →
OMARCHY_QEMU_GPU_*→kernel-argument path three existing settings already take. Happy to split it out
if you would rather see the packages land on their own.
Deliberately excluded
fcitx5-chinese-addons— hard-depends onqt6-webengine, which does notfit the 6144 MiB image. Add Chinese input and locale to the factory guest #63 hit the same wall. Bopomofo via
fcitx5-chewingdoes not need it.
fcitx5-configtool— upstream does not ship it either, and it pulls a KDEdependency chain for a GUI the seeded profile makes unnecessary.
image.sizeMiB— that value is duplicated as a runtime contract inrun-qemu-gpu.shand asserted inrun-qemu-ssh-contract.test.sh; changing itis an architecture discussion, not part of this.
English, and README says so. Upstream has no translation mechanism; those
strings are hardcoded in its shell scripts.
On the two earlier attempts
#26 and #63 both proposed Simplified Chinese and were closed by their own
authors. The only maintainer feedback on either was on #26:
That PR bumped
requestedFileSha256without a real resolve. This one's lock isa genuine refresh: nine resolved entries, no existing version touched.
Validation
Package lock — regenerated with
guest/build-container.sh --refresh-package-lockagainst current
main, not carried over from an earlier branch. The diff is nineadditions, zero removals, and no change to any existing version:
enchant·fcitx5·fcitx5-chewing·fcitx5-gtk·fcitx5-qt·libchewing·noto-fonts-cjk·xcb-imdkit·yogaFive are requested in
packages.txt; the other four are transitive(
libchewingfor the Chewing engine,xcb-imdkitforfcitx5-qt's XCB inputmethod,
enchantandyogaviafcitx5).Tests —
./guest/testpasses: 110 Python tests including eight newtest_locale.pycases (allowlist parity, symlink refusal, shell-metacharacterpayloads, idempotency), plus the native guest contract with the new zh-TW
assertions.
swift testpasses 254 tests including eleven new pure-model casesfor the preference store and menu presentation.
Image —
make guestcompletes and the packed root sits at 82.97% of the6144 MiB budget, inside
pack-image.sh's 85% ceiling.Booted — built the image, chose Traditional Chinese in the start menu, and
ran a disposable VM through first-boot provisioning on an Apple Silicon Mac. In
the guest:
xdg-user-dirsrenamed the home directories (桌面, 下載, 文件, 音樂, 圖片, 影片,專案),
ezaprinted dates as11 9月 02:09, and every glyph rendered — no tofu.Ctrl+Spacereached Chewing andsu3cl3committed 你好, after whichCtrl+Spacereturned to plain US input:Leaving the Language row alone emits no kernel argument;
/etc/locale.confthengets the image default, which is also what makes switching back to English take
effect on a VM that has already run in Chinese.
🤖 Generated with Claude Code