Skip to content

Add one-step Traditional Chinese input setup - #12312

Closed
linyiru wants to merge 2 commits into
omacom:quattrofrom
linyiru:zh-tw-chewing-input
Closed

linyiru wants to merge 2 commits into
omacom:quattrofrom
linyiru:zh-tw-chewing-input

Conversation

@linyiru

@linyiru linyiru commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Refs #11456.

Omarchy already runs fcitx5 in every session for the Caps Lock compose sequences, so Traditional Chinese input only needs an engine registered with it. omarchy-setup-input-chewing does that in one step, with a menu row under Setup > Input Method.

What it does

  • Installs fcitx5-chewing, then restarts fcitx5 so the running instance sees it — fcitx5 only scans for engines at startup.
  • Appends chewing to the current input method group over DBus rather than replacing the group, so an fcitx5-mozc or Korean engine added earlier stays put.
  • Reruns as a no-op once chewing is in the group.
  • Stops with a clear message if fcitx5 isn't reachable, instead of writing a broken group.

Manual

manual/34-keyboard-mouse-trackpad.md gains a "Typing in Traditional Chinese" section: the Ctrl+Space toggle, how to move Chewing off the standard Bopomofo arrangement to Hsu or ETen with fcitx5-configtool, and why the left-Shift tap that Windows users reach for does nothing here.

That last one is #7440. The default kb_options includes shift:both_capslock_cancel, which gives the Shift keys a two-level alphabetic mapping, so the release keysym is Caps_Lock rather than Shift_L and fcitx5's release-of-modifier check never matches. The manual documents it and offers the kb_options = "compose:caps" opt-out rather than changing the default for everyone.

Tests

  • test/shell.d/input-chewing-test.sh — three scenarios with omarchy-pkg-add, fcitx5-remote and busctl mocked, asserting that the group append preserves engines that were already there.
  • test/acceptance.d/input-chewing-test.sh — runs the setup command, types su3cl3 into a foot window with wtype, and asserts Han characters were committed. It follows security-test.sh for OMARCHY_ACCEPTANCE_SUDO_PASSWORD, including the pty, so the validated credential reaches the setup command's own sudo.

The acceptance assertion tests the Han codepoint range rather than an exact string, on purpose: Bopomofo reaches Han through a candidate list whose order comes from Chewing's phrase dictionary and adapts to earlier selections, so unlike Hangul no exact output is guaranteed. Two mechanics the test had to account for, both found the hard way in a live session — selecting the engine needs fcitx5-remote -o as well as -s chewing, since a group whose first entry is a plain keyboard layout starts out in passthrough; and Chewing consumes the first Return committing its pre-edit buffer, so the reader needs a second one.

Verification

On a live Omarchy session (Arch, fcitx5-chewing 5.1.13-1, libchewing 0.13.1-1):

check result
./test/cli pass
./test/shell with this change 5 of 245 files fail
./test/shell on quattro, unchanged 5 of 244 files fail — same list
the 4 new assertions inside ./test/shell pass

Those 5 are pre-existing and environment-related (config, locate, kernel-migration, snapper, unowned-system-paths); this change adds none.

The setup command and the composing path were exercised by hand in that session: engine registration, the toggle, and Bopomofo committing Han. The acceptance file itself has not been run through omarchy-iso-test — I don't have the ISO harness set up, so it's worth a run on your side.

Scope

Deliberately opt-in. #11456 asks whether preinstall or the first-run wizard is preferred, and this takes neither position — it's one command and one menu row, so wiring it into the wizard later is small. Pinyin (fcitx5-chinese-addons) would slot in the same way as a sibling command.

No overlap with #12142, which themes the fcitx5 candidate window.

🤖 Generated with Claude Code

Every session already runs fcitx5 for the compose sequences, so Bopomofo
only needs an engine registered with it. omarchy-setup-input-chewing
installs fcitx5-chewing, restarts fcitx5 so it picks the engine up, and
appends chewing to the current input method group rather than replacing
it, leaving a Japanese or Korean engine added earlier in place.

The manual covers the Ctrl+Space toggle, how to change the Bopomofo
arrangement away from standard, and why the left-Shift toggle that
Windows users expect does not fire under the default kb_options.
default/omarchy/launcher.hides:11 hides fcitx5-configtool, so both the
manual section and the setup command's closing message pointed at a GUI
that never shows up in the launcher after installing it. Name the
terminal instead.

Found by @akitaonrails while reviewing the Japanese sibling, omacom#9634.
@linyiru

linyiru commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

Cross-reference, because this turns out to be one of three open siblings and the description named none of them.

Prior art I should have credited. #11719 (@MoerAI, Korean, opened 2026-09-13) and #9634 (@komagata, Japanese, opened 2026-09-01) do this job for their languages. This PR is the same work as #11719: the same six files, the same DBus append instead of a group rewrite, the same readiness loop, and the same explanatory comments word for word, with the engine name changed. #11719 was there four days first and the description here credits neither sibling, which it should have.

All three collide on one line. Each of the three adds exactly this to default/omarchy/omarchy-menu.jsonc, byte for byte:

"setup.input-method": {"icon":"󰗊","label":"Input Method"},

Each then adds its own row beneath that one, an assertion in the same block of test/shell.d/menu-test.sh, a bin/omarchy-setup-input-<engine>, a test/shell.d/input-<language>-test.sh, a test/acceptance.d/input-<language>-test.sh, and a change to manual/34-keyboard-mouse-trackpad.md. So whichever lands first brings the parent row with it and the other two become sibling-only diffs. This one is the newest of the three, so it should be the one that rebases. Landing them in the order they were opened, #11719 then #9634 then this, keeps all three diffs trivial.

The manual is the only part of that merge which is not mechanical, because the three touch it differently. #9634 rewrites the shared fcitx5 paragraph so Japanese goes through the menu and every other language stays at fcitx5-configtool; #11719 and this PR each append a language section below that paragraph and leave it alone. Once any two of the three land, that paragraph should name the menu path once instead of enumerating languages by hand, and the sections below it can carry the per-engine detail.

The setup command is now written three times. Beyond the readiness loop, the three scripts share the restart-then-wait sequence, the group-append via busctl, and the same failure message. What differs is a package name, an engine id, a label and a closing line. That is a shape that wants one command taking the engine as an argument, or at least a shared omarchy-fcitx5-wait-ready, rather than a fourth copy when the next language arrives. I am not proposing either inside this PR, since it would have to touch all three branches: whoever lands first is in the position to extract it, and the other two shrink to almost nothing. Happy to send that follow-up once one of them is in.

There is evidence the shared knowledge does not survive copying. @akitaonrails found on #9634 that fcitx5-remote --check writes the input state to stdout, so without >/dev/null 2>&1 the readiness loop leaks a digit into the presentation terminal; komagata fixed it in f903b4e, two weeks after the PR was opened. #11719 and this PR both carry the redirect and a comment saying why (bin/omarchy-setup-input-chewing:14). One shared command would have carried that comment to all three.

What @akitaonrails' review of #9634 changes here. Two of its three points apply to this PR unchanged.

  • fcitx5-configtool is listed in default/omarchy/launcher.hides:11, so telling people to install it and pick an engine under Input Method points them at a window the launcher never shows. Fixed here in 47bbb48, in both the new manual section and the setup command's closing line. Worth noting that the text that review quoted is the shared paragraph's fcitx5-chinese-addons clause, which is this PR's language rather than Japanese: Add one-step Japanese input setup #9634 already fixes that line, so I have deliberately not duplicated the fix and put a conflict on it. The same caveat is still missing from Add one-step Korean input setup #11719's Dvorak and Colemak paragraph, which also sends people to fcitx5-configtool.
  • Enable Wayland input methods in Chromium-based browsers #12139 is a prerequisite for this PR too, not only for Japanese. Until --enable-wayland-ime lands, Chewing works in every GTK and Qt app and in the terminal, and silently does nothing in the default browser, which is where someone who just ran this setup is most likely to try it first. A different cause, but the same shape as Make the menu search line a real text input #12338, where the menu's own search line cannot take input from any CJK engine.

Its closing note carries over as well, and neither of those two issues is Mozc-specific on its own report: #11303 was filed with fcitx5-rime, a Chinese engine, and #7559 is about candidate placement in native Wayland Chromium and Electron, reproducing in Obsidian too and not under XWayland. Both sit in the popup path rather than in an engine, so Chewing users should expect to meet them.

@komagata

komagata commented Sep 18, 2026 •

Copy link
Copy Markdown

@linyiru Thank you for taking the time to connect these PRs, acknowledge the earlier work, and explain how they fit together. I really appreciate you carrying the findings from @akitaonrails’ review over to the Chewing setup as well!

I agree that the shared Fcitx 5 setup flow and the manual should be consolidated as these land. Keeping the current PRs focused and extracting the common logic in a follow-up sounds good to me. Thank you for offering to work on that.

I’ve added links to the Korean and Traditional Chinese PRs in #9634. If either lands first, I’m happy to adjust the Japanese PR’s parent menu entry and documentation to match. The shared menu instructions plus per-engine details sound like a good structure.

For #12139, I’d keep tracking it separately for now: #11719 notes that current Chromium enables the relevant support by default, while #12139 notes that a comparison with and without the flag is still missing. It would be useful to resolve that across the affected browser versions before treating it as a prerequisite for all three setup PRs.

Thanks again for helping make these changes work together for users across languages!

@jandrusk

Copy link
Copy Markdown

Thanks for tying this to #11456 and calling out the Korean sibling #11719 — the shared one-step input-setup pattern is the right direction (Japanese #13327 too).

Currently CONFLICTING against quattro. After a rebase, worth aligning menu/docs wording with #11719 so we do not land three slightly different Setup > Input rows. No other blocking notes from a skim.

@omarchybot

Copy link
Copy Markdown
Collaborator

Thank you for this. What it does is now on quattro, so I am closing it.

This is now on quattro through #14433: Chewing is a preset and a base package, and the installer offers Chinese (Traditional, Zhuyin). The Shift note was about shift:both_capslock_cancel, which quattro no longer ships.

This was checked against quattro by Claude, with Codex at medium effort verifying the claims above. If something here is still missing, say so and this can be reopened.

@omarchybot omarchybot closed this Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants