Skip to content

omamobile-shell 0.2.132: Japanese input with fcitx5 and Mozc (omamobile-ime) - #763

Open
ikegam wants to merge 2 commits into
derekross:mainfrom
ikegam:omamobile-ime-mozc
Open

ikegam wants to merge 2 commits into
derekross:mainfrom
ikegam:omamobile-ime-mozc

Conversation

@ikegam

@ikegam ikegam commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Japanese input on the phone, off by default. This brings back #693 with the language switch working.

  • omamobile-ime on: fcitx5 with Mozc takes Hyprland's input method, and squeekboard's keys reach it through the keyboard grab. Romaji converts with Space and commits with Enter.
  • Mozc converts only while the globe key's language is "Japanese (romaji)" (a copy of the US layout, added by on). With any other language keys pass through as typed, so a password in English is safe.
  • off gives the input method back to squeekboard.
  • Needs hyprland 0.57.0-3.4: resend an on-screen keyboard's replaced keymap to the input method #762 (hyprland 0.57.0-3.4). Without it, Space reaches fcitx5 as "l".

Known limits: squeekboard no longer pops up for text fields (double-tap the home strip), candidates take no taps, and there's no Kana layout.

Tested on my 7 Pro (2026-11-14, with #762): typed and converted Japanese. Shell test/all (new ime.sh) and tools/pr-check pass.

🤖 Generated with Claude Code

@ikegam
ikegam force-pushed the omamobile-ime-mozc branch from edfd7de to 74b433c Compare November 14, 2026 23:37
@ikegam ikegam changed the title omamobile-shell 0.2.129: Japanese input with fcitx5 and Mozc (omamobile-ime) omamobile-shell 0.2.130: Japanese input with fcitx5 and Mozc (omamobile-ime) Nov 14, 2026
…le-ime)

`omamobile-ime on` hands Hyprland's one input method to fcitx5 with Mozc,
and `off` gives it back to squeekboard. squeekboard's keys reach fcitx5
through the keyboard grab, so romaji converts with Space and commits with
Enter. Mozc converts only while the keyboard's language (the globe key) is
"Japanese (romaji)", a copy of the US layout that `on` adds to the list;
with any other language fcitx5 passes keys through as typed. At login
omamobile-ime.service restarts squeekboard once fcitx5 holds the input
method, then follows the language. Off by default, and inert while off.

With it on, squeekboard no longer sees text fields (double-tap the home
strip), candidates take no taps, and the Kana layout can't be used (it
needs more keycodes than a keymap has). Needs hyprland 0.57.0-3.4 (derekross#762).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgnCmDwY8r4r1jCa2SVYLN
@ikegam
ikegam force-pushed the omamobile-ime-mozc branch from 74b433c to d906fa0 Compare November 15, 2026 04:33
@ikegam ikegam changed the title omamobile-shell 0.2.130: Japanese input with fcitx5 and Mozc (omamobile-ime) omamobile-shell 0.2.132: Japanese input with fcitx5 and Mozc (omamobile-ime) Nov 15, 2026
@derekross

Copy link
Copy Markdown
Owner

Thank you, Hiroyuki. Japanese input that stays off until you ask for it, and that converts only while the keyboard's language is Japanese (romaji), so an English password passes through untouched, is a good shape for this. Keying the login unit on the same ~/.config/omamobile/fcitx5 file that already keeps fcitx5 from starting means nothing changes for anyone who hasn't run omamobile-ime on, and copying the US layout so the keymap fits the grab is a neat way round the kana views' keycodes.

I read it through and ran test/ime.sh here (it passes). One thing to change before I merge:

  1. A failed fcitx5-remote stops the follower, and each restart takes the keyboard away. The script runs under set -e, and apply ends with fcitx5-remote -g …, which exits 1 while fcitx5 isn't reachable yet. So at a slow login (or when fcitx5 restarts) session exits, systemd starts it again two seconds later, and each start runs restart_squeekboard, so the on-screen keyboard disappears and comes back until fcitx5 answers or systemd gives up, and then Mozc no longer follows the language. I tried it with a stand-in fcitx5-remote that fails: the follower exits at the first call. Could apply failing just log a line (or retry briefly), and could the squeekboard restart happen only once per session, for example behind a marker in $XDG_RUNTIME_DIR? A test case with a failing fcitx5-remote that expects the follower to keep running would hold it.

Three smaller things, take or leave:

  • session waits up to 20 s for squeekboard, and test/ime.sh runs it five times, so on a machine without squeekboard (CI, my laptop) the test takes over three minutes. An override for that wait would make it a few seconds.
  • The language sheet offers every layout file it finds, so "Japanese (romaji)" now shows up on every phone, where without omamobile-ime on it's a US keyboard under a Japanese name. Hiding it unless the switch file exists would keep it to the phones that use it.
  • Since generate no longer writes the four jp+romaji files, a later change to us.yaml won't reach them; a test comparing their bodies with the US files would catch that. Their headers also still say "Language: English (US)".

This merges after #762, which your README names as 0.57.0-3.4; I plan to merge #762 first so that number holds. I'll set the shell version when I merge (0.2.132 or the next free one).

ikegam added a commit to ikegam/omarchy-mobile that referenced this pull request Nov 15, 2026
…swer

From the review of derekross#763. A failed fcitx5-remote (fcitx5 not up yet at a
slow login, or restarting) ended `session` under set -e, and each restart
of the unit restarted squeekboard, so the keyboard went and came back
until systemd gave up. Now a failed apply is logged and retried for up to
10 s at start, later changes are still applied, and squeekboard is
restarted once per login session (a marker in $XDG_RUNTIME_DIR, cleared
by on and off).

Also from the review: the waits can be shortened for tests (the test runs
in seconds), Japanese (romaji) is offered in the language sheet only while
Japanese input is on, the jp+romaji headers name their language, and a
test keeps their bodies the same as the US files'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgnCmDwY8r4r1jCa2SVYLN
@ikegam

ikegam commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the careful read, Derek, and for trying it with a failing fcitx5-remote. Fixed in 058aff6: a failed apply is logged and retried, later changes still apply, and squeekboard restarts once per login session (a marker in $XDG_RUNTIME_DIR, cleared by on and off), each with a test. The three smaller ones are in too: the waits can be overridden (ime.sh now runs in about 4 s), Japanese (romaji) is offered only while the switch is on, and a test keeps the jp+romaji bodies the same as the US files.

Input methods are a big step, and I'd like people who type other languages to shape where this goes, so I've opened #801 for that. This PR stays the Japanese first step.

…swer

From the review of derekross#763. A failed fcitx5-remote (fcitx5 not up yet at a
slow login, or restarting) ended `session` under set -e, and each restart
of the unit restarted squeekboard, so the keyboard went and came back
until systemd gave up. Now a failed apply is logged and retried for up to
10 s at start, later changes are still applied, and squeekboard is
restarted once per login session (a marker in $XDG_RUNTIME_DIR, cleared
by on and off).

Also from the review: the waits can be shortened for tests (the test runs
in seconds), Japanese (romaji) is offered in the language sheet only while
Japanese input is on, the jp+romaji headers name their language, and a
test keeps their bodies the same as the US files'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgnCmDwY8r4r1jCa2SVYLN
@ikegam
ikegam force-pushed the omamobile-ime-mozc branch from 714ba7d to 058aff6 Compare November 15, 2026 06:26
@derekross

Copy link
Copy Markdown
Owner

On the language sheet: please show "Japanese (romaji)" only once omamobile-ime on has been run. Picked without the IME it's a US layout under a Japanese name, and nobody should land there by accident. Hiding the row while the IME is off (or having on install the layout file and off remove it) is fine either way. With that, plus the drift test for the US copies, this is ready after #762.

@derekross

Copy link
Copy Markdown
Owner

Thank you, Hiroyuki, this is a thorough answer. I checked each part: the follower now logs and keeps going when fcitx5 doesn't answer, squeekboard restarts once per session behind the marker (and again after on), test/ime.sh runs in under five seconds here, and the new test keeps the four Japanese (romaji) files the same as the US ones. My comment this afternoon asked for something you had already done: I hadn't seen that the language sheet now hides the row while the switch is off. Sorry for the noise.

One small thing is left on that same point. on adds Japanese (romaji) to the keyboard's languages, but off doesn't take it out again, so after on and then off the globe key still switches to it, and it's then a US keyboard with a Japanese name and no Mozc behind it. I tried it with the sheet's helper: with the switch off it isn't offered to add, but it's still in the list. Could off remove just that entry from the sources (the next language becomes current if it was the current one), with a line in test/ime.sh checking it's gone?

With that, this is ready once #762 is in. I'll set the shell version when I merge: 0.2.132 goes to #425, which merges first, so this takes the next free number.

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.

2 participants