Skip to content

Reset the keyboard layout before selecting a Fcitx engine - #15602

Open
EyasDmour wants to merge 2 commits into
omacom:quattrofrom
EyasDmour:fix/composition-base-layout
Open

EyasDmour wants to merge 2 commits into
omacom:quattrofrom
EyasDmour:fix/composition-base-layout

Conversation

@EyasDmour

@EyasDmour EyasDmour commented Oct 16, 2026 •

Copy link
Copy Markdown

With us,ara configured, cycling from Arabic to Mozc leaves the Arabic keyboard layout active. Mozc receives Arabic key symbols and types Arabic instead of composing Japanese. This also reproduces with Russian and Greek layouts, and with Pinyin and Hangul.

Switch matching keyboards back to the first configured layout before activating the Fcitx engine. Omarchy uses that layout as the Fcitx group's default, including non-US layouts and variants.

Regression tests cover both cycle directions, multiple keyboards, queued selections without a focused text field, and layout-switch failures.

Validation

  • bash test/shell.d/input-indicator-test.sh: all 23 checks pass; the regression fails on unmodified upstream.
  • Real Mozc, Pinyin and Hangul on an isolated Fcitx session: all 15 cases pass across US + Arabic/Russian/Greek, French OSS + Arabic, and JIS + Russian. Unmodified upstream fails 14; French/Hangul with an explicit US override is the passing control. These checks use real XKB maps and engines with simulated compositor queries and switches.
  • Combined with Keep non-typing HIDs out of the keyboard layout pick #15290: the input indicator and keyboard layout tests pass.
  • ./test/all: CLI passes. Eight of 446 shell test files fail; the same eight fail on an untouched checkout of the upstream base.
Full-suite failures reproduced on upstream

default-apps, elsewhen-migration, fontconfig-cjk, i18n, screenrecording-process, update-file-conflict, update-stay-awake-security, windows-vm-mount-boundary.

The graphical VM acceptance suite was not run.

Follow-up to #14433.

@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with no actionable issues found.

Summary

The PR restores the leading compositor layout before selecting a Fcitx engine.

  • Composition engines start from the configured base keyboard layout.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Choose next input method] --> B[Switch matching keyboards to chosen layout or base]
  B -->|Success| C[Refresh Fcitx selection]
  B -->|Failure| D[Stop before engine activation]
  C --> E{Text context exists?}
  E -->|Yes| F[Call SetCurrentIM]
  E -->|No| G[Keep selection queued]
Loading

Reviews (2) · Last reviewed commit: "Clarify layout reset regression coverage" · Reviewed by Greptile

@EyasDmour EyasDmour changed the title Restore the base layout before cycling into Fcitx engines Reset the keyboard layout before selecting a Fcitx engine Oct 16, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Read the change at d1d7d4d against quattro: select_next in default/input-methods/indicator.py now switches the matching keyboards to the first compositor layout before selecting a composition engine, instead of leaving whatever layout was active. That first layout is the one default/hypr/input.lua puts in front (US ahead of a non-Latin layout) and the one configure.py writes as the Fcitx group's Default Layout, so the reset lands on the layout the engines expect. I read the diff and the code around it only; nothing has been run on a worker yet, and no reproduction has been attempted.

The classification is not settled, so no label went on. I (Claude Opus 5.5) read this as a bug fix, but the second model that classifies independently, Codex Medium, did not run: the reviewer answers, but today's review allowance was already spent. Only an agreement between the two counts, so this one waits for the next pass to classify it again and then reproduce it on a worker: Arabic active, cycle into Mozc, failing on quattro and passing on this head.

Nothing is needed from you yet. It is waiting on that next pass, then on the maintainer.

@EyasDmour

EyasDmour commented Oct 23, 2026 •

Copy link
Copy Markdown
Author

@dhh — could you take a look at these follow-ups to your input-method work in #14433 when you have a chance?

This PR fixes the previous keyboard layout carrying over into Mozc/Pinyin/Hangul. I reproduced the failure on quattro and verified the fix with real input engines. I saw the bot's Oct 17 update about waiting for another classification and reproduction pass; happy to provide anything else that would help.

Also linking #15625, the separate language-switch OSD improvement. It keeps candidate selection and per-app language memory working. The two PRs can be reviewed and merged independently.

Thanks!

@azinoviev

Copy link
Copy Markdown

Reproduced on Omarchy 4.5.0-3 with us,ru + Pinyin — same root cause

Environment: Hyprland 0.56.2, fcitx5 5.1.23 with fcitx5-chinese-addons, Fcitx group
[keyboard-us, pinyin], compositor layouts us,ru. Tested in foot 1.28 (+ime,
Wayland text-input), with no local modifications to the stock input handling.

Repro:

  1. From the us position, cycle forward with Super+I: us → ru → pinyin.
  2. Type nihao in any text field.

Result: Cyrillic characters are typed — no composition, no candidate window. Notably,
the engine is selected and reports active (fcitx5-remote → 2, current IM
pinyin); it just receives Cyrillic key symbols through the compositor's Russian
keymap and passes them through.

Control (Super+Shift+I backward from the us position, which enters pinyin
directly while the compositor stays on us): typing nihao composes 你好 with
candidates, exactly as expected.

The only difference between the two paths is the active compositor layout at the
moment the engine becomes current — which matches this PR's diagnosis. The same
asymmetry reproduces via the bar widget / omarchy-shell shell cycleInput next,
so it's not keybinding-specific.

@azinoviev

Copy link
Copy Markdown

Fix verification: I applied this PR's runtime change locally (the select_next hunk of indicator.py) and tested through the
cycle path (Super+I / Super+Shift+I):

start: keyboard-us / English (US)
step1: keyboard-us / Russian ← compositor layout switch
step2: pinyin / English (US) ← layout reset on engine entry
step3: keyboard-us / English (US) ← clean round-robin

Typing with the engine entered from the ru side now composes correctly in both
directions (tested nihao → 你好 with Pinyin). Backward cycling and the bar-widget
cycle behave as expected.

Would love to see this merged — happy to retest the branch if anything changes.

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.

3 participants