Skip to content

Commit c099fc2

Browse files
committed
docs(linux): IME 環境変数の手動設定ガイドを README に追加
非日本語ロケールで fcitx5 / ibus を後付けインストールした環境では、 IME 連携用の環境変数(GTK_IM_MODULE / XMODIFIERS 等)がセッションに 伝わらず、エディタで漢字変換が効かないことがある(WebKit2GTK + IME 全般の挙動)。 恒久的な対処は OS 側で `im-config` または `~/.config/environment.d/` で env を立てる方法、起動時のみの対処は `GTK_IM_MODULE=fcitx ...` を コマンドプレフィクスで渡す方法を README.md / README.en.md の Linux インストール節に追記。 判断経緯と試行錯誤(in-app での set_var / re-exec を試したが効果なし、 最終的に OS 側に倣う方針に確定)は PROGRESS.md の判断ログに記録。
1 parent 2da0e2f commit c099fc2

3 files changed

Lines changed: 42 additions & 0 deletions

File tree

PROGRESS.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,18 @@ Typstudio fork 路線 vs ゼロスタート路線の判断材料を集め、技
688688
- **判断**:Universe テンプレ取り込み UI は **Phase 2 で扱う**(Phase 1 Sprint 3 では同梱テンプレのみ)。Phase 2 の「パッケージ管理 UI」項目を Universe 連携 UI として具体化(取り込み / 閲覧 / キャッシュ可視化の 3 機能)
689689
-:Sprint 3 の残タスクに戻る(フォーム型テンプレ簡素版 / ツールバー D&D 編集 UI / キーバインド設定 UI など)
690690

691+
### 2026-05-05: Linux IME 対応はアプリ側で持たない方針(README 案内に切替)
692+
- **発端**(氏報告):US EN locale の Ubuntu に後付けで fcitx5(SKK / Mozc)を入れた環境で、Yuhitsu のエディタで漢字変換ができない。手動で `GTK_IM_MODULE=fcitx ./yuhitsu` 等を付けると動作する
693+
- **試行 1**:`ensure_im_env()` を実装し、起動時に走っている IME daemon(fcitx5 / fcitx / ibus-daemon)を `pgrep -x` で検出して `GTK_IM_MODULE` / `QT_IM_MODULE` / `XMODIFIERS``std::env::set_var` で補完。Windows / macOS には影響しない `#[cfg(target_os = "linux")]`
694+
- **試行 2**:set_var では効かなかったので `main()` 冒頭(tauri::Builder 構築前)で呼ぶ位置に移動 → 効かず
695+
- **試行 3**:`std::os::unix::process::CommandExt::exec()`**自分自身を再起動** し execve(2) の env として渡す形に変更(無限ループ防止に YUHITSU_IM_ENV_FIXED マーカ)。`/proc/<pid>/environ` で env が正しく立っているのを確認したものの、それでも漢字変換は復旧しなかった
696+
- **試行 4**:shell から `GTK_IM_MODULE=fcitx XMODIFIERS=@im=fcitx pnpm tauri dev` で起動 → アプリ内ログ `[ime] GTK_IM_MODULE already set (fcitx), leaving as-is` が出て env は確実に inherit されている。が **これでも変換できなかった**(env タイミングの問題ではなく、CodeMirror 6 + WebKit2GTK + fcitx5 wayland の組み合わせの別レイヤーの問題と思われる)
697+
- **氏判断**:**アプリ側で env の自動補正は持たない**。VS Code / Firefox / Chromium 等の主要 OSS も持っておらず、Linux 界隈の標準は OS セッション側で env を立てておくこと(`im-config` / `~/.profile` / `~/.config/environment.d/`)。Yuhitsu のターゲット層は Windows 中心で、Linux ユーザの大半は既に env が立っている前提でよい
698+
- **対応**:
699+
- `ensure_im_env()` および main.rs の呼び出しを撤去(コードを単純化)
700+
- README.md / README.en.md の Linux インストール節に「IME が効かない場合」のサブブロックを追加し、`im-config` または起動時の env 指定を案内
701+
- **残課題**:env を立てた状態でも変換が復旧しなかった環境特有の問題は、OS 側 env 設定で本当に直るかを別環境で再検証する余地あり(本セッションの再現環境では未確認)。エディタ層(CodeMirror 6 の composition events)が原因の可能性も残るが、Phase 2 以降で必要に応じて深掘りする
702+
691703
### 2026-05-06: tinymist を sidecar として同梱(PATH 依存解消)
692704
- **発端**(氏報告):GUI 起動の Yuhitsu で「LSP 起動に失敗」エラー。原因は GNOME がアプリを spawn するときの PATH に `~/.local/bin` が含まれず `tinymist` が見つからない為。一般 Linux ユーザは大抵 tinymist 未インストールなので、配布物としても致命的
693705
- **当初の構想**:.deb の Depends:、起動時検出 + GUI 案内、wrapper script、sidecar 同梱の 4 案を比較

README.en.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,21 @@ chmod +x yuhitsu_*.AppImage
8484
sudo dpkg -i yuhitsu_*.deb
8585
```
8686

87+
> 💡 **If Japanese / CJK IME doesn't work**
88+
>
89+
> On Linux distros installed in a non-Japanese locale where fcitx5 / ibus was added later, the IME-bridge environment variables may not be set in your session, which can break kanji conversion in the editor. This is general WebKit2GTK + fcitx5 / ibus behavior, not Yuhitsu-specific.
90+
>
91+
> On Ubuntu, the standard fix is `im-config -n fcitx5` (or `ibus`). Alternatively, set the variables when launching:
92+
>
93+
> ```bash
94+
> # fcitx5
95+
> GTK_IM_MODULE=fcitx XMODIFIERS=@im=fcitx yuhitsu
96+
> # ibus
97+
> GTK_IM_MODULE=ibus XMODIFIERS=@im=ibus yuhitsu
98+
> ```
99+
>
100+
> To persist them, add to `~/.profile` or `~/.config/environment.d/im.conf`.
101+
87102
### Windows
88103
89104
Download the `.msi` installer from Releases and run it.

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,21 @@ chmod +x yuhitsu_*.AppImage
8484
sudo dpkg -i yuhitsu_*.deb
8585
```
8686

87+
> 💡 **日本語入力(IME)が効かない場合**
88+
>
89+
> 日本語ロケールでない Linux に後付けで fcitx5 / ibus 等を入れた環境では、IME 連携用の環境変数がセッションに伝わっていないことがあり、Yuhitsu のエディタで漢字変換ができないことがあります(WebKit2GTK + fcitx5 / ibus 全般の挙動で、Yuhitsu 固有ではありません)。
90+
>
91+
> Ubuntu の場合は `im-config -n fcitx5`(または `ibus`)でセッション設定を行うのが標準です。設定しない場合は、起動時に明示する方法でも回避できます:
92+
>
93+
> ```bash
94+
> # fcitx5 を使う場合
95+
> GTK_IM_MODULE=fcitx XMODIFIERS=@im=fcitx yuhitsu
96+
> # ibus を使う場合
97+
> GTK_IM_MODULE=ibus XMODIFIERS=@im=ibus yuhitsu
98+
> ```
99+
>
100+
> 永続化するなら `~/.profile``~/.config/environment.d/im.conf` 等に書きます。
101+
87102
### Windows
88103
89104
`.msi` インストーラを Releases から DL → 実行。

0 commit comments

Comments
 (0)